Skip to main content

AgentGuard

Detect loops and wasted LLM/tool calls in real time.


Install

pip install agentguard


Usage

1. Decorator Mode (Recommended)

Wrap your functions with @track. Every call is recorded automatically.

from agentguard import start_guard, stop_guard, track

start_guard()

@track
def search(x):
    return x

for x in ["a", "b", "c", "a", "b", "c"]:
    search(x)

stop_guard()

2. Manual Mode (Full Control)

Use the Guard class directly. Best when you need runtime control.

from agentguard.guard import Guard

g = Guard()
g.start()

for x in ["a", "b", "c", "a", "b", "c"]:
    g.track_step("search", x)

    if g.should_stop():
        print("Stopping early")
        break

print(g.stop())

3. Hybrid Mode (Advanced)

from agentguard import start_guard, stop_guard, track

start_guard()

@track
def search(x):
    return x

for x in ["a", "b", "c", "a", "b", "c"]:
    search(x)

stop_guard()

# Hybrid mode allows combining decorator tracking with manual control if needed

Example Output

AgentGuard Report

Verdict: BAD (High Waste) Reason: Too many repeated calls (61%)


Total Calls: 44 Wasted Calls: 27 Waste Ratio: 61%

Status:

  • Loop Detected: No
  • High Waste: Yes

Warnings:

  • High number of repeated calls

Suggestions:

  • Cache or reuse previous tool results
  • Avoid duplicate LLM/tool calls

Why use AgentGuard?

  • Detect infinite loops in AI agents
  • Identify wasted LLM or tool calls
  • Reduce API costs
  • Improve efficiency of workflows

Status

v0.1 — Core detection working

Download files

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

Source Distribution

agentguard_kit-0.1.0.tar.gz (6.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_kit-0.1.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agentguard_kit-0.1.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.5

File hashes

Hashes for agentguard_kit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c78379532076f2436bc2dfa417db24ba665b7842c1fbef3a3c0c05cf048e4088
MD5 375d8b4d4165e1d44e51e53752a65bc7
BLAKE2b-256 c775d159ff28e08e86318bccd92937cfa4092a699f8b83d7e3163425ad1dd614

See more details on using hashes here.

File details

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

File metadata

  • Download URL: agentguard_kit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.5

File hashes

Hashes for agentguard_kit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c925cff64f9ddcccaf2f563e5894af545d3f8a0f7fca11161721dc388c0af231
MD5 8992b87924c52ad0a42c382d353abf20
BLAKE2b-256 2991129e0dab2a05914c1c6cf746926d7cc88020dbb7e438b58732594bea1b09

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