Agent discovery — MCP-style for agents calling agents
Query a live registry of agents at runtime. Filter by tag and health, hand the result to an LLM as a tool list, let it pick.
The control plane keeps a live registry of every reasoner and skill across your fleet. Query it at runtime, filter by tag and health, and hand the result to the LLM as a tool list. New agent comes online → the LLM finds it on the next call.
from agentfield import Agent
from agentfield.tool_calling import ToolCallConfig
app = Agent(node_id="orchestrator")
@app.reasoner()
async def smart_route(question: str) -> dict:
# Inspect the live registry — health-aware
caps = app.discover(
tags=["public"],
health_status="active",
include_input_schema=True,
)
# caps.json.total_agents tells you how many are online right now
# Hand the registry to the LLM as a tool list. It picks and calls.
result = await app.ai(
system="Pick the best available agent to answer the user's question.",
user=question,
tools="discover",
)
# Trace shows exactly which tools the LLM invoked
for call in result.trace.calls:
print(f" {call.tool_name} ({call.latency_ms:.0f}ms)")
return {"answer": result.text}
# Large registries — send names+descriptions first, hydrate full schemas on demand
@app.reasoner()
async def lazy_route(question: str) -> dict:
return await app.ai(
user=question,
tools=ToolCallConfig(
schema_hydration="lazy",
max_candidate_tools=50, # show 50 tools to the LLM
max_hydrated_tools=10, # full schemas only for the 10 it picks
),
)
app.run()The same registry powers the control plane UI. The Agent nodes page shows every registered agent, its tags, its reasoners, and whether it's online — which is exactly the data feeding app.discover():
What this gives you
- The tool list is generated from the live registry on every call — no static config.
- Lazy hydration keeps context windows manageable when you have hundreds of agents.
- The trace records every dispatch so routing decisions are debuggable.
Next
Trigger agents on memory changes
Subscribe a reasoner to a memory key pattern. When any agent writes to a matching key, the reasoner fires.
Signed audit chain for any workflow
Every step of a multi-agent workflow becomes a signed Verifiable Credential. Pull the whole chain in topological order with one request.