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.
This is the MCP-style path for AgentField agents calling AgentField agents: discover the live capability list, then call the chosen target with app.call("node.function"). If the capability should cross an organization or network boundary, use external agent discovery as the public opt-in layer.
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 from GitHub, Stripe, Slack, or any custom webhook
Bind a reasoner to an external event source. The control plane verifies the signature, drops replays, and dispatches the event to your reasoner.
Expose agents to external discovery
Use Agentic Resource Discovery to publish selected AgentField capabilities, import trusted outside agents, and make only approved imports callable.