strands-agt
Microsoft Agent Governance Toolkit (AGT) policy enforcement for Strands Agents.
Provides a deterministic, YAML-based InterventionHandler that gates tool calls before execution — no model judgment involved.
Installation
pip install strands-agt
Quick Start
from strands import Agent
from strands_agt import AGTGovernance
governance = AGTGovernance(policies="policies.yaml")
agent = Agent(tools=[...], interventions=[governance])
result = agent("search for documents")
Policy Format
Policies are defined in YAML:
policies:
- name: allow-search
effect: allow
actions: ["search"]
principals: ["User::*"]
- name: deny-delete
effect: deny
actions: ["delete_file"]
reason: "File deletion is not permitted"
Effects
| Effect | Strands Action | Behavior |
|---|---|---|
allow |
Proceed() |
Tool executes normally |
deny |
Deny(reason=...) |
Tool is blocked, reason shown to model |
steer |
Guide(feedback=...) |
Tool is blocked with corrective guidance |
Evaluation Order
- Deny policies are checked first — first match short-circuits
- Steer policies are checked next
- Allow policies are checked last — first match permits
- No match = deny (fail-closed)
Features
Role-Based Access
governance = AGTGovernance(
policies="role_policies.yaml",
principal_resolver=lambda state: {
"type": state.get("user_role", "User"),
"id": state.get("user_id", "anonymous"),
},
)
agent = Agent(tools=[...], interventions=[governance])
agent("Delete backups", invocation_state={"user_role": "Admin", "user_id": "alice"})
Rate Limiting
policies:
- name: rate-limited-email
effect: allow
actions: ["send_email"]
conditions:
session.call_count:
lt: 5
Context Enrichment
governance = AGTGovernance(
policies="env_policies.yaml",
context_enricher=lambda ctx: {
"environment": os.environ.get("DEPLOY_ENV", "development"),
"tenant_id": ctx["invocation_state"].get("tenant_id"),
},
)
Condition Operators
Conditions support: lt, lte, gt, gte, eq, neq, in.
conditions:
session.call_count:
lt: 10
input.database:
in: ["analytics", "staging"]
Configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
policies |
str | list[str] |
required | YAML policy file path(s) or inline YAML |
principal |
dict[str, str] | None |
{"type": "User", "id": "anonymous"} |
Static principal identity |
principal_resolver |
Callable | None |
None |
Dynamic resolver from invocation_state |
context_enricher |
Callable | None |
None |
Injects extra fields into policy context |
on_error |
str |
"throw" |
Error mode: "throw", "proceed", or "deny" |
Development
pip install -e ".[dev]"
pytest
ruff check src tests
mypy src
References
Metadata
Release files for strands-agt 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| strands_agt-0.1.0.tar.gz | 13.3 kB | Without provenance | Details for strands_agt-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| strands_agt-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for strands_agt-0.1.0-py3-none-any.whl |
Total release size: 25.9 kB
Release files / strands_agt-0.1.0.tar.gz
| Download URL | strands_agt-0.1.0.tar.gz |
|---|---|
| Size | 13.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f423e98385c770d5cc567e5f3a9b2a87cd7960a90908e16ff92236d145ea9b2b
|
|
BLAKE2b-256 checksum How to use checksums |
cc43664008735afc56def3c6d0655ef2378edf1732a14b47a4e2cb699d1cdd2f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.4
|
Release files / strands_agt-0.1.0-py3-none-any.whl
| Download URL | strands_agt-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
934ae392576f4090b3dab93a8567284ecd25a685ffbdf00681f24f8270ecaee5
|
|
BLAKE2b-256 checksum How to use checksums |
7056da855a8411c63f768b997a09be0d797c10e74364e491af32f205bd20a3b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.4
|
Security for strands-agt 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.