agentvoy-guard
Runtime guardrails enforcement for AI agents. Reads agent.guard.yml and enforces limits at execution time.
pip install agentvoy-guard
What it enforces
| Guardrail | Config key | What happens |
|---|---|---|
| Iteration limit | guardrails.behavior.max_iterations |
Raises IterationLimitError |
| Tool call limit | guardrails.behavior.max_tool_calls |
Raises ToolCallLimitError |
| Cost limit | guardrails.behavior.cost_limit |
Raises CostLimitError |
| Timeout | guardrails.behavior.timeout |
Raises TimeoutError |
| Prompt injection | guardrails.input.block_prompt_injection |
Raises PromptInjectionError |
| PII detection | guardrails.input.pii_detection |
Warns or raises PIIDetectedError |
| Network access | permissions.network |
Patches urllib/requests/httpx |
| Shell execution | permissions.execution.allow_shell |
Patches os.system |
| Subprocess | permissions.execution.allow_subprocess |
Patches subprocess |
Quick start
from agentvoy_guard import Guard
# Loads agent.guard.yml automatically from current directory
guard = Guard.from_config()
with guard.session() as session:
# Check user input before passing to agent
session.check_input(user_prompt)
for i in range(100):
session.tick() # enforces max_iterations + timeout
response = client.messages.create(
model="claude-sonnet-4-20250514",
messages=messages,
tools=tools,
)
session.track_usage(response.usage) # enforces cost_limit
if response.stop_reason == "tool_use":
session.tick_tool() # enforces max_tool_calls
elif response.stop_reason == "end_turn":
break
session.check_output(final_text)
print(guard.last_summary)
# {'iterations': 3, 'tool_calls': 2, 'elapsed_seconds': 4.1,
# 'input_tokens': 1240, 'output_tokens': 380, 'estimated_cost_usd': 0.000952}
Decorator usage
@guard.protect
def run_agent(prompt: str) -> str:
# input checked automatically, output checked on return
...
agent.guard.yml reference
version: "1.0"
model:
provider: anthropic
model: claude-sonnet-4-20250514
permissions:
network:
mode: restricted # open | restricted | disabled
allow: ["*.github.com"]
deny: ["*.social-media.com"]
execution:
allow_shell: false
allow_subprocess: false
guardrails:
input:
block_prompt_injection: true
pii_detection: warn # off | warn | block
max_tokens: 4096
behavior:
max_iterations: 20
max_tool_calls: 50
timeout: 5m
cost_limit: "$1.00"
Supported model pricing
Token costs are tracked for: gpt-4o, gpt-4o-mini, gpt-4-turbo, o1, claude-opus-4, claude-sonnet-4, claude-haiku-4, gemini-2.0-flash, gemini-2.5-pro, llama-3.3-70b, mistral-large.
Part of AgentVoy
agentvoy-guard is part of the AgentVoy platform — the universal AI agent development platform.
npx agentvoy create my-agent # scaffolds agent.guard.yml automatically
License
Apache 2.0
Metadata
Release files for agentvoy-guard 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 |
|---|---|---|---|---|
| agentvoy_guard-0.1.0.tar.gz | 15.2 kB | Without provenance | Details for agentvoy_guard-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agentvoy_guard-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for agentvoy_guard-0.1.0-py3-none-any.whl |
Total release size: 31.2 kB
Release files / agentvoy_guard-0.1.0.tar.gz
| Download URL | agentvoy_guard-0.1.0.tar.gz |
|---|---|
| Size | 15.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
876da6b72a30d3c9357558d1a9c8e877d4beae30c8e72f3bc3b915c6d9c56444
|
|
BLAKE2b-256 checksum How to use checksums |
721f61096f394daadf769aa57279ef5e69c503283f9666b05d2c862150191112
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Release files / agentvoy_guard-0.1.0-py3-none-any.whl
| Download URL | agentvoy_guard-0.1.0-py3-none-any.whl |
|---|---|
| Size | 15.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cf4d409086cd2d4bc430474e90410b8451db87e3cc0c75a83e17584b3f27edf4
|
|
BLAKE2b-256 checksum How to use checksums |
c0dd827ac2047e6ef823920c11a8021433b79f93176d6ba7cd6702d10500c593
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Security for agentvoy-guard 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.