OpenAI Function Calling bridge for the Agenium agent:// protocol.
Automatically discovers agent capabilities via DNS + agent cards, converts them to OpenAI-compatible tool definitions, and executes tool calls against agent endpoints.
pip install openai-agenium-bridgeimport asyncio
from openai import OpenAI
from openai_agenium import AgeniumBridge
async def main():
bridge = AgeniumBridge()
# Discover agents → OpenAI tool definitions
tools = await bridge.discover_tools([
"agent://search.agenium",
"agent://weather.agenium",
])
# Use with OpenAI
client = OpenAI()
response = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": "Search for AI papers"}],
tools=tools,
)
# Execute any tool calls
if response.choices[0].message.tool_calls:
results = await bridge.execute(response.choices[0].message.tool_calls)
for r in results:
print(f"{r.skill}: {'✓' if r.success else '✗'} {r.result or r.error}")
asyncio.run(main())- DNS Resolution — Resolves
agent://URIs via Agenium DNS (185.204.169.26:3000) - Agent Card Fetch — Gets
/.well-known/agent-cardfrom each agent's endpoint - Tool Conversion — Maps agent skills → OpenAI function-calling tool definitions
- Execution — Sends Agenium protocol frames to agent endpoints with retries
| Method | Description |
|---|---|
discover_tools(uris) |
Resolve agents and return OpenAI tool defs |
execute(tool_calls) |
Execute OpenAI tool calls against agents |
clear_cache() |
Clear DNS resolver cache |
bridge = AgeniumBridge(
dns_server="185.204.169.26", # Agenium DNS server
dns_port=3000, # DNS HTTP port
request_timeout=30.0, # Per-request timeout
max_retries=3, # Retry count on failure
)Supports optional domain registration on the Agenium DNS system using a marketplace API key (dom_<64 hex>). Pass api_key parameter to auto-register your agent on startup. Get your API key from the Telegram Domain Marketplace.
MIT