Metadata-Version: 2.5
Name: ratchet-authz-autogen
Version: 0.1.0
Summary: AutoGen intervention-handler adapter for the Ratchet authorization broker.
Project-URL: Homepage, https://github.com/1manideep/ratchet
Project-URL: Repository, https://github.com/1manideep/ratchet
Project-URL: Issues, https://github.com/1manideep/ratchet/issues
Author: Manideep Pendyala
License-Expression: MIT
Keywords: agents,authorization,autogen,capability-tokens,llm,macaroons,security
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Security
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: autogen-core>=0.4
Requires-Dist: ratchet-authz-core<0.2,>=0.1
Description-Content-Type: text/markdown

# ratchet-authz-autogen

AutoGen adapter for **[Ratchet](https://github.com/1manideep/ratchet)** —
plugs the [Ratchet authorization broker](https://github.com/1manideep/ratchet)
into a `DefaultInterventionHandler` registered on the
`SingleThreadedAgentRuntime`. No monkey-patching of AutoGen itself; a
hijacked model still can't exceed what was explicitly delegated to it.

## Install

```bash
pip install ratchet-authz-autogen
```

## Minimal usage

```python
from ratchet_core import Broker, Ed25519WorkloadIdentity, tool_name_caveat
from ratchet_autogen import RatchetInterventionHandler

broker = Broker()
primary = Ed25519WorkloadIdentity("primary-agent")
token = broker.issue(
    human_identity="alice@example.com",
    primary_identity=primary,
    caveats=[tool_name_caveat("run_python")],
)

handler = RatchetInterventionHandler(
    broker,
    token_resolver=lambda msg, ctx: token,
    identity_resolver=lambda msg, ctx: primary,
)
runtime = SingleThreadedAgentRuntime(intervention_handlers=[handler])
```

Full runnable example and architecture diagram:
https://github.com/1manideep/ratchet/blob/main/examples/autogen_example.py
