Search Agents
Creative examples showing various search and discovery patterns.
Find MCP-Aware Agents
Section titled “Find MCP-Aware Agents”from agent0_sdk import SDKimport os
# Initialize SDK# Subgraph automatically uses default URL - no configuration needed!sdk = SDK( chainId=11155111, rpcUrl=os.getenv("RPC_URL"))
# Find all agents with MCP endpointsresults = sdk.searchAgents(mcp=True)for agent in results['items']: print(f"{agent.name} - MCP enabled")import { SDK } from 'agent0-sdk';
async function main() { // Initialize SDK // Subgraph automatically uses default URL - no configuration needed! const sdk = new SDK({ chainId: 11155111, rpcUrl: process.env.RPC_URL || '', });
// Find all agents with MCP endpoints (async in TypeScript) const results = await sdk.searchAgents({ mcp: true }); for (const agent of results.items) { console.log(`${agent.name} - MCP enabled`); }}
main().catch(console.error);Find Agents by Skills
Section titled “Find Agents by Skills”# Python developersresults = sdk.searchAgents(a2aSkills=["python"])print(f"Found {len(results['items'])} Python agents")// Python developers (async in TypeScript)const results = await sdk.searchAgents({ a2aSkills: ['python'] });console.log(`Found ${results.items.length} Python agents`);Highly-Rated Agents
Section titled “Highly-Rated Agents”# Top-rated agentsresults = sdk.searchAgentsByReputation( minAverageScore=90, tags=["enterprise"])for agent in results['items']: print(f"{agent.name}: {agent.extras['averageScore']}")// Top-rated agents (async in TypeScript)const results = await sdk.searchAgentsByReputation( 90, // minAverageScore ['enterprise'] // tags);for (const agent of results.items) { console.log(`${agent.name}: ${agent.extras.averageScore}`);}Multi-Criteria Search
Section titled “Multi-Criteria Search”# Complex searchresults = sdk.searchAgents( mcpTools=["code_generation", "analysis"], a2aSkills=["python", "javascript"], active=True, x402support=True, supportedTrust=["reputation"])
print(f"Found {len(results['items'])} matching agents")// Complex search (async in TypeScript)const results = await sdk.searchAgents({ mcpTools: ['code_generation', 'analysis'], a2aSkills: ['python', 'javascript'], active: true, x402support: true, supportedTrust: ['reputation'],});
console.log(`Found ${results.items.length} matching agents`);Pagination
Section titled “Pagination”# Paginated resultscursor = Noneall_agents = []
while True: results = sdk.searchAgents(page_size=50, cursor=cursor) all_agents.extend(results['items'])
cursor = results.get('nextCursor') if not cursor: break
print(f"Total agents: {len(all_agents)}")// Paginated results (async in TypeScript)let cursor: string | undefined;const allAgents = [];
while (true) { const results = await sdk.searchAgents( undefined, // params undefined, // sort 50, // pageSize cursor ); allAgents.push(...results.items);
cursor = results.nextCursor; if (!cursor) { break; }}
console.log(`Total agents: ${allAgents.length}`);