# nerq-autogen

Trust verification tool for [AutoGen](https://github.com/microsoft/autogen) multi-agent conversations. Check agent safety before interaction with the [Nerq Trust Index](https://nerq.ai).

## Install

```bash
pip install nerq-autogen
```

## Quick Start

```python
from nerq_autogen import trust_check_tool

# Register as an AutoGen tool
tool = trust_check_tool(min_trust=70)
```

## Full Example — Multi-Agent Conversation

```python
import autogen
from nerq_autogen import NerqTrustTool

trust = NerqTrustTool(min_trust=70)

# Check before adding an agent to conversation
result = trust.check("langchain")
if result["approved"]:
    print(f"Agent approved: score={result['trust_score']}, grade={result['trust_grade']}")
else:
    print(f"Agent rejected: score={result['trust_score']}")

# Use as AutoGen function tool
assistant = autogen.AssistantAgent("assistant", llm_config={"tools": [trust_check_tool()]})
```

## Configuration

| Parameter | Default | Description |
|-----------|---------|-------------|
| `min_trust` | 60 | Minimum trust score to approve |
| `api_base` | `https://nerq.ai` | Nerq API endpoint |
| `cache_ttl` | 300 | Cache TTL in seconds |

## Response Format

```python
{
    "agent_name": "langchain",
    "trust_score": 88.5,
    "trust_grade": "A",
    "approved": True,
    "recommendation": "PROCEED"
}
```

## Links

- [Nerq Trust Index](https://nerq.ai)
- [Integration Hub](https://nerq.ai/integrate)
- [AutoGen Integration Docs](https://nerq.ai/integrate/autogen)
- [PyPI](https://pypi.org/project/nerq-autogen/)
