Skip to content
AgentGuard logo

AgentGuard

Verified

Python SDK that caps agent spend and halts runaway loops in real time.

Autonomous AgentsAgent Frameworks 3Open source
View on GitHub
Updated 2026-06-15
AgentGuard GitHub repository

What is AgentGuard?

AgentGuard provides in-process controls that stop problematic agent behavior before costs escalate. It monitors tool calls, retries, and token usage across providers and raises exceptions to terminate runs that exceed defined thresholds.

The library integrates without altering existing agent frameworks and requires no external services unless an HTTP sink is explicitly configured. It focuses on runtime enforcement rather than post-run analysis or network-level routing.

Developers building autonomous agents that interact with tools or external APIs benefit most, especially when runs involve multiple providers or repeated operations that risk uncontrolled spending.

Capabilities

detect agent loops
enforce budgets
track costs
enable deterministic replay
provide runtime guardrails

What you can build with AgentGuard

Budget Protection Across Providers

Set a single spending cap that covers calls to OpenAI, Anthropic, and other services in one run, preventing combined overruns from many small requests.

Loop and Retry Prevention

Automatically detect repeated tool calls or endless retry attempts and raise exceptions to end the process before resources are wasted.

Timeout Enforcement

Apply wall-clock limits to long-running agents so they cannot hang indefinitely and consume unexpected compute time.

Install AgentGuard

Install
pip install agentguard47
Quick start
pip install agentguard47
agentguard
  1. 1Install via pip with the agentguard47 package.
  2. 2Import the guards into your Python agent code.
  3. 3Configure budget, loop, retry, and timeout settings as needed.
  4. 4Run the agent normally; guards activate automatically inside the process.
  5. 5Review local JSONL traces after any terminated run for details.

Works with

LangChain

AgentGuard: pros & cons

Pros

  • +Zero external dependencies and fully local operation by default.
  • +Raises exceptions in-process to stop runs immediately.
  • +Supports mixed-provider budget tracking in a single envelope.
  • +MIT licensed with optional HTTP reporting only when enabled.

Cons

  • Limited to Python environments only.
  • Does not provide OS-level sandboxing or filesystem controls.
  • Requires manual integration into each agent codebase.
Did you find this helpful?

Frequently asked questions

No, all tracing and reporting stay local unless you explicitly enable the HttpSink option.

User reviews

Verified reviews from the community shape this listing's rating.

Loading reviews…

Sign in to review

Promote AgentGuard

Add this badge to your website, or share the tool.

DFeatured on DhanasviAgentGuard 0