Skip to content

Python: Package the ATR validation middleware (#6528 sample) as an installable agent-framework-atr provider #7061

Description

@eeee2345

Background

PR #6528 (merged) added a sample demonstrating deterministic validation at the tool-execution boundary (#5366), delegating detection to the open-source Agent Threat Rules (ATR) ruleset via the pyatr engine: python/samples/02-agents/middleware/atr_validation_middleware.py.

Today it is only a sample. This proposes promoting it to a first-class installable package, agent-framework-atr, mirroring the agent-framework-purview security-middleware package, so it gets pip-installable distribution, IDE autocompletion, and docs.

Proposed scope

  • ATRFunctionMiddleware (FunctionMiddleware): deterministic block at the tool-execution boundary (the Add deterministic validation at execution boundary for agent actions #5366 pattern) — checks before call_next(), so a matched tool never runs.
  • ATRAgentMiddleware (AgentMiddleware): scans inbound user messages and blocks the run on a match.
  • ATRDetector: a shared wrapper over the local pyatr engine; detection is deterministic with no model call in the enforcement path.
  • Depends on agent-framework-core + pyatr (MIT, pure-Python, only needs pyyaml which core already ships).

Open questions for maintainers

  1. Do you want ATR as a first-class packaged provider, or should it stay a sample?
  2. Package name: agent-framework-atr — acceptable?
  3. Namespace: Purview is surfaced under agent_framework.microsoft. ATR is an independent, open standard (not a Microsoft product), so I have kept the public import path as agent_framework_atr and deliberately did not add it to agent_framework.microsoft. Does that match your preference, or would you rather it be surfaced under a namespace?

I have an implementation ready and will open a PR referencing this issue. Happy to adjust naming, scope, or namespace based on your answer.

Metadata

Metadata

Labels

pythonUsage: [Issues, PRs], Target: Python

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions