Metadata-Version: 2.4
Name: managed-agents
Version: 0.1.2
Summary: Nomotic governance layer for Managed Agents
Project-URL: Homepage, https://nomotic.ai
Project-URL: Repository, https://github.com/nomoticai/managed-agents
License: MIT
Keywords: ai-agents,claude,governance,managed-agents,nomotic
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27.0
Provides-Extra: dev
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-asyncio; extra == 'dev'
Requires-Dist: respx; extra == 'dev'
Description-Content-Type: text/markdown

# managed-agents

Nomotic governance for managed AI agents. Works with any framework — Claude, LangChain, CrewAI, AutoGen, or custom harnesses.

Govern every tool call before it reaches execution. DENY verdicts block the action, ESCALATE routes to human review, and every evaluation is recorded in your Nomotic audit trail.

## Installation

```bash
pip install managed-agents
```

## Quick Start

```python
from managed_agents import NomoticHarness, GovernanceDenied

harness = NomoticHarness(
    api_key="nm_live_...",       # from amp.nomotic.ai/settings
    agent_id="nmc-...",          # from amp.nomotic.ai/identity
    platform="claude",           # or "langchain", "crewai", "autogen", "custom"
)

async def execute_tool(tool_name: str, tool_input: dict) -> str:
    await harness.govern(tool_name, tool_input)
    return await your_runtime.execute(tool_name, tool_input)

try:
    await execute_tool("write_file", {"path": "/etc/passwd", "content": "..."})
except GovernanceDenied as e:
    print(f"Blocked: {e}")
```

## How It Works

```
Agent decides tool call -> NomoticHarness.govern() -> POST /api/v1/govern
  ALLOW    -> execute tool
  DENY     -> raise GovernanceDenied (tool never executes)
  ESCALATE -> human review queue (configurable)
```

## Framework Examples

### Claude Managed Agents
```python
harness = NomoticHarness(api_key="nm_live_...", agent_id="nmc-...", platform="claude")
```

### LangChain / LangGraph
```python
harness = NomoticHarness(api_key="nm_live_...", agent_id="nmc-...", platform="langchain")
```

### CrewAI
```python
harness = NomoticHarness(api_key="nm_live_...", agent_id="nmc-...", platform="crewai")
```

### AutoGen
```python
harness = NomoticHarness(api_key="nm_live_...", agent_id="nmc-...", platform="autogen")
```

The `platform` parameter tags evaluations in the audit trail so you can filter by framework.

## Configuration

| Parameter | Default | Description |
|---|---|---|
| `api_key` | required | Nomotic API key |
| `agent_id` | required | Nomotic agent ID |
| `platform` | `"custom"` | Framework identifier for audit context |
| `fail_open` | `True` | Allow on governance service error |
| `block_on_escalate` | `False` | Raise on ESCALATE verdict |
| `timeout` | `3.0` | HTTP timeout in seconds |
| `on_verdict` | `None` | Callback for every verdict |

## Links

- [Nomotic Platform](https://amp.nomotic.ai)
- [Documentation](https://docs.nomotic.ai/integrations/managed-agents)
