Metadata-Version: 2.4
Name: agentguard-kit
Version: 0.1.0
Summary: Detect loops and wasted calls in AI agents
Author: Rudra Mistry
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# 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.

```python
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.

```python
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)

```python
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
