Skip to main content

AgentGuard

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


Install

pip install agentguard-kit


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.1.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.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agentguard_kit-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 4b23b2b2d0500a25163a9c2c5b2e9171b662d86e086781ed18942cf08c7cb2c7
MD5 f24f9b518a76c0bc409d2b997900092a
BLAKE2b-256 db19d92f25d45ae5c49565585a744a978a07bdd1c9fb2ab1fdd88f8c9ea1fa70

See more details on using hashes here.

File details

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

File metadata

  • Download URL: agentguard_kit-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1d1f485b38ea990086e8cbdc654d7a042432cdb215b2ed89a6769b92686bba79
MD5 7d1eda65991c29db62f03d7527a26b51
BLAKE2b-256 a502dd6e23216921336b128178202246df6dbf01ee9c5b230b058cecc2f6ee9a

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