Cryptographic identity and delegation for the OpenAI Agents SDK.
Every agent gets a did:agent: DID. Tool calls carry delegation proofs. Agent-to-agent handoffs preserve the authority chain.
pip install kanoniv-openai-agentsfrom kanoniv_agent_auth import AgentKeyPair
from kanoniv_openai_agents import DelegatedRunner, delegated_tool
root = AgentKeyPair.generate()
runner = DelegatedRunner(root)
orchestrator = AgentKeyPair.generate()
runner.authorize_agent(orchestrator, actions=["web_search", "code_exec"], max_cost=10.0)
@delegated_tool(actions=["web_search"], require_cost=True)
def web_search(query, cost, _delegation_proof=None, **kw):
return f"Results for: {query}"
runner.register_tool(web_search)
result = runner.run_tool(orchestrator, "web_search", {"query": "AI", "cost": 0.5})search_agent = AgentKeyPair.generate()
runner.handoff(orchestrator, search_agent, actions=["web_search"], max_cost=3.0)
# search_agent can only web_search, max $3 (narrower than orchestrator's $10)runner.revoke(search_agent)
# All subsequent tool calls by search_agent raise ValueError| Method | Description |
|---|---|
authorize_agent(keypair, actions, max_cost, expires_in_hours) |
Delegate from root |
handoff(from_keypair, to_keypair, actions, max_cost) |
Agent-to-agent sub-delegation |
register_tool(func) |
Register a tool function |
run_tool(keypair, tool_name, args) |
Execute with delegation verification |
revoke(keypair) |
Revoke delegation |
audit_log |
List of verified actions |
- kanoniv-agent-auth - Core identity and delegation library
- OpenAI Agents SDK
- MCP Auth Proposal
MIT