Skip to main content

Real-time cost observability and guardrails for AI agents

Project description

AgentGuard

Real-time cost observability and guardrails for AI agents.

Track LLM spend, set budget thresholds, and auto-pause agents before they blow up your bill.

Install

pip install agentguard

Quick Start

from agentguard import AgentGuard, AgentEvent

guard = AgentGuard(
    api_key="ag_...",
    agent_id="my-sales-agent",
    cost_threshold=10.0,          # auto-pause at $10/day
    slack_webhook="https://...",  # optional alert
)

# Custom agent — wrap with decorator
@guard.track
def run_my_agent():
    # your agent logic here
    alive = guard.send_event(AgentEvent(
        agent_id="my-sales-agent",
        event_type="llm_call",
        model="gpt-4o",
        input_tokens=500,
        output_tokens=300,
    ))
    if not alive:
        print("Agent paused — cost threshold reached")
        return

LangChain / LangGraph

from agentguard import AgentGuard

guard = AgentGuard(api_key="ag_...", agent_id="my-agent", cost_threshold=5.0)

# Drop-in callback — tracks every LLM call automatically
chain = my_chain.with_config(callbacks=[guard.callback])
result = chain.invoke({"input": "do something"})

Supported Models

Model Input (per 1M) Output (per 1M)
gpt-4o $2.50 $10.00
gpt-4o-mini $0.15 $0.60
claude-3-5-sonnet $3.00 $15.00
claude-3-5-haiku $0.80 $4.00
gemini-1.5-pro $1.25 $5.00

Dashboard

View live costs, event feed, and manage agents at agent-guard-nine.vercel.app.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentguard_ram-0.1.0.tar.gz (56.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentguard_ram-0.1.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file agentguard_ram-0.1.0.tar.gz.

File metadata

  • Download URL: agentguard_ram-0.1.0.tar.gz
  • Upload date:
  • Size: 56.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for agentguard_ram-0.1.0.tar.gz
Algorithm Hash digest
SHA256 93e24cba98094355efd4f9bf192fb1a8049260f27f5dc357fe0f01ac35e24828
MD5 5edebe091a106d13cf80acc492645f98
BLAKE2b-256 fff81f74709cebe590fdfcad255733c48c23516c246ec7bc753192ab6b5259d2

See more details on using hashes here.

File details

Details for the file agentguard_ram-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: agentguard_ram-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for agentguard_ram-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 02b074a5da1011d08969eda49998e72e5d879067ba04bd55c64d3771a5b28f5e
MD5 0c18fd1f54586a22869ef9a2a37b3b0d
BLAKE2b-256 6e103e38257e00c844353b2a204d24f2ca5a153467205b0bda3a623584a2c37b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page