Skip to content

kanoniv/kanoniv-openai-agents

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

kanoniv-openai-agents

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.

Install

pip install kanoniv-openai-agents

Quick Start

from 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})

Agent-to-Agent Handoff

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)

Revocation

runner.revoke(search_agent)
# All subsequent tool calls by search_agent raise ValueError

API

DelegatedRunner

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

Links

License

MIT

About

Cryptographic identity and delegation for OpenAI Agents SDK

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages