1"use strict";(self.webpackChunkinnovation_labs=self.webpackChunkinnovation_labs||[]).push([[2179],{79989:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>d,default:()=>h,frontMatter:()=>a,metadata:()=>t,toc:()=>o});const t=JSON.parse('{"id":"examples/adapters/a2a-inbound-adapter-example","title":"A2A Inbound Adapter Example","description":"This guide runs two independent A2A HTTP endpoints. Each endpoint is a bridge to a different Agentverse uAgent. There is no shared router or coordinator in the sample \u2014 A2A clients call each port separately.","source":"@site/docs/examples/adapters/a2a-inbound-adapter.md","sourceDirName":"examples/adapters","slug":"/examples/adapters/a2a-inbound-adapter-example","permalink":"/resources/docs/next/examples/adapters/a2a-inbound-adapter-example","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{"id":"a2a-inbound-adapter-example","title":"A2A Inbound Adapter Example"},"sidebar":"tutorialSidebar","previous":{"title":"LangGraph Adapter for uAgents","permalink":"/resources/docs/next/examples/adapters/langgraph-adapter-example"},"next":{"title":"A2A Outbound Adapter Example","permalink":"/resources/docs/next/examples/adapters/a2a-outbound-adapter-example"}}');var r=s(74848),i=s(28453);const a={id:"a2a-inbound-adapter-example",title:"A2A Inbound Adapter Example"},d="A2A Inbound Adapter Example",l={},o=[{value:"What we are building",id:"what-we-are-building",level:2},{value:"Architecture",id:"architecture",level:2},{value:"Prerequisites",id:"prerequisites",level:2},{value:"Step 1: Installation",id:"step-1-installation",level:2},{value:"Step 2: Agentverse mailbox and environment",id:"step-2-agentverse-mailbox-and-environment",level:2},{value:"Step 3: Choose your agents",id:"step-3-choose-your-agents",level:2},{value:"Option A: Marketplace agents",id:"option-a-marketplace-agents",level:3},{value:"Option B: Your own uAgents",id:"option-b-your-own-uagents",level:3},{value:"Step 4: Build the adapter scripts",id:"step-4-build-the-adapter-scripts",level:2},{value:"Perplexity Search Agent",id:"perplexity-search-agent",level:3},{value:"Finance Q&A Agent",id:"finance-qa-agent",level:3},{value:"Step 5: Run the adapters",id:"step-5-run-the-adapters",level:2},{value:"Terminal 1: Perplexity",id:"terminal-1-perplexity",level:3},{value:"Terminal 2: Finance",id:"terminal-2-finance",level:3},{value:"Step 6: Test with A2A JSON-RPC",id:"step-6-test-with-a2a-json-rpc",level:2},{value:"Step 7: Discover agent cards",id:"step-7-discover-agent-cards",level:2},{value:"Production",id:"production",level:2},{value:"Security",id:"security",level:3},{value:"Scaling",id:"scaling",level:3},{value:"Troubleshooting",id:"troubleshooting",level:2},{value:"Next steps",id:"next-steps",level:2},{value:"Resources",id:"resources",level:2}];function c(e){const n={a:"a",admonition:"admonition",code:"code",em:"em",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.header,{children:(0,r.jsx)(n.h1,{id:"a2a-inbound-adapter-example",children:"A2A Inbound Adapter Example"})}),"\n",(0,r.jsxs)(n.p,{children:["This guide runs ",(0,r.jsx)(n.strong,{children:"two independent A2A HTTP endpoints"}),". Each endpoint is a bridge to a different Agentverse uAgent. There is ",(0,r.jsx)(n.strong,{children:"no shared router or coordinator"})," in the sample \u2014 A2A clients call each port separately."]}),"\n",(0,r.jsx)(n.p,{children:"By the end you will have:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["A Perplexity search bridge on A2A port ",(0,r.jsx)(n.strong,{children:"9002"})," (uAgent bridge port ",(0,r.jsx)(n.strong,{children:"8002"}),")"]}),"\n",(0,r.jsxs)(n.li,{children:["A Finance Q&A bridge on A2A port ",(0,r.jsx)(n.strong,{children:"9003"})," (uAgent bridge port ",(0,r.jsx)(n.strong,{children:"8003"}),")"]}),"\n",(0,r.jsxs)(n.li,{children:["Working ",(0,r.jsx)(n.strong,{children:"JSON-RPC"})," test requests (not a ",(0,r.jsx)(n.code,{children:"/chat"})," route)"]}),"\n",(0,r.jsxs)(n.li,{children:["Agent cards at ",(0,r.jsx)(n.code,{children:"/.well-known/agent-card.json"})]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["Page id / URL slug: ",(0,r.jsx)(n.code,{children:"a2a-inbound-ad
1apter-example"})," (this file is ",(0,r.jsx)(n.code,{children:"a2a-inbound-adapter.md"}),")."]}),"\n",(0,r.jsx)(n.h2,{id:"what-we-are-building",children:"What we are building"}),"\n",(0,r.jsx)(n.p,{children:"We'll expose two marketplace agents as A2A servers:"}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Perplexity Search Agent"})," \u2014 web search and research"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Finance Q&A Agent"})," \u2014 financial Q&A"]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["For a coordinator that ",(0,r.jsx)(n.em,{children:"routes"})," among inbound agents, see ",(0,r.jsx)(n.a,{href:"https://github.com/fetchai/innovation-lab-examples/tree/main/a2a-uAgents-Integration/a2a-Inbound-Communication/Multiagent-Planner",children:"Multiagent Planner"})," in ",(0,r.jsx)(n.code,{children:"innovation-lab-examples"}),". That is a different architecture from this page."]}),"\n",(0,r.jsx)(n.h2,{id:"architecture",children:"Architecture"}),"\n",(0,r.jsxs)(n.p,{children:["Each adapter process starts ",(0,r.jsx)(n.strong,{children:"two listeners"}),":"]}),"\n",(0,r.jsxs)(n.table,{children:[(0,r.jsx)(n.thead,{children:(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.th,{children:"Port"}),(0,r.jsx)(n.th,{children:"Role"}),(0,r.jsx)(n.th,{children:"Who talks to it"})]})}),(0,r.jsxs)(n.tbody,{children:[(0,r.jsxs)(n.tr,{children:[(0,r.jsxs)(n.td,{children:[(0,r.jsx)(n.code,{children:"port"})," (9002 / 9003)"]}),(0,r.jsx)(n.td,{children:"A2A HTTP (JSON-RPC)"}),(0,r.jsxs)(n.td,{children:["A2A clients, ",(0,r.jsx)(n.code,{children:"curl"})]})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsxs)(n.td,{children:[(0,r.jsx)(n.code,{children:"bridge_port"})," (8002 / 8003)"]}),(0,r.jsx)(n.td,{children:"Bridge uAgent + mailbox"}),(0,r.jsxs)(n.td,{children:["Agentverse mailbox, ",(0,r.jsx)(n.a,{href:"https://agentverse.ai/inspect/",children:"inspector"})]})]})]})]}),"\n",(0,r.jsxs)(n.p,{children:["A2A client \u2192 ",(0,r.jsx)(n.code,{children:":9002"})," \u2192 bridge uAgent ",(0,r.jsx)(n.code,{children:":8002"})," \u2192 Agentverse target. Repeat the same pattern on ",(0,r.jsx)(n.code,{children:":9003"})," / ",(0,r.jsx)(n.code,{children:":8003"})," for Finance. Inspector URLs use the ",(0,r.jsx)(n.strong,{children:"bridge"})," port, not the A2A port."]}),"\n",(0,r.jsx)("div",{style:{textAlign:"center"},children:(0,r.jsx)("img",{src:"/resources/img/adapters/a2a-inbound-adapter-example.png",alt:"a2a-inbound-adapter-example",style:{width:"100%",maxWidth:"1000px"}})}),"\n",(0,r.jsxs)(n.p,{children:["Background: ",(0,r.jsx)(n.a,{href:"/docs/A2A-Integration/what-is-a2a",children:"What is A2A?"})," and the ",(0,r.jsx)(n.a,{href:"https://github.com/fetchai/uAgents/tree/main/python/uagents-adapter/src/uagents_adapter/a2a_inbound",children:"inbound adapter README"}),"."]}),"\n",(0,r.jsx)(n.h2,{id:"prerequisites",children:"Prerequisites"}),"\n",(0,r.jsxs)(n.admonition,{title:"Versions",type:"note",children:[(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.strong,{children:"Python 3.10+"})}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:(0,r.jsx)(n.code,{children:"uagents==0.25.5"})})," (pin used across these docs)"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:(0,r.jsx)(n.code,{children:"uagents-adapter[a2a-inbound]==0.6.2"})})," (pulls ",(0,r.jsx)(n.code,{children:"a2a-sdk"}),", uvicorn, httpx, click, python-dotenv)"]}),"\n"]}),(0,r.jsxs)(n.p,{children:["See the ",(0,r.jsx)(n.a,{href:"/docs/agent-creation/uagents-adapter-guide",children:"uAgents Adapter guide"}),"."]})]}),"\n",(0,r.jsxs)(n.p,{children:["Example clone path for related inbound samples (coordinator + Perplexity/Finance ",(0,r.jsx)(n.em,{children:"A2A agents"}),", not these two bridge scripts):"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:"git clone https://github.com/fetchai/innovation-lab-examples.git\ncd innovation-lab-examples/a2a-uAgents-Integration/a2a-Inbound-Communication/Multiagent-Planner\n"})}),"\n",(0,r.jsxs)(n.p,{children:["The two files in ",(0,r.jsx)(n.strong,{children:"this"})," tutorial (",(0,r.jsx)(n.code,{children:"perplexity_adapter.py"}),", ",(0,r.jsx)(n.code,{children:"finance_adapter.py"}),") live in the code blocks below. Pin dependencies with:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-text",metastring:'title="requirements.txt"',children:"uagents==0.25.5\nuagents-adapter[a2a-inbound]==0.6.2\npython-dotenv>=1.0.0\n"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:"python --version\npip install -r requirements.txt\n"})}),"\n",(0,r.jsx)(n.p,{children:"PowerShell:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-powershell",children:"python --version\npip install -r requirements.txt\n"})}),"\n",(0,r.jsx)(n.h2,{id:"step-1-installation",children:"Step 1: Installation"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:'pip install "uagents==0.25.5" "uagents-adapter[a2a-inbound]==0.6.2"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["This extra installs ",(0,r.jsx)(n.code,{children:"a2a-sdk"}),", ",(0,r.jsx)(n.code,{children:"uvicorn"}),", ",(0,r.jsx)(n.code,{children:"httpx"}),", ",(0,r.jsx)(n.code,{children:"click"}),", and ",(0,r.jsx)(n.code,{children:"python-dotenv"}),"."]}),"\n",(0,r.jsx)(n.h2,{id:"step-2-agentverse-mailbox-and-environment",children:"Step 2: Agentverse mailbox and environment"}),"\n",(0,r.jsxs)(n.p,{children:["The inbound adapter creates a ",(0,r.jsx)(n.strong,{children:"mailbox"})," bridge uAgent (",(0,r.jsx)(n.code,{children:"mailbox=True"}),"). The mailbox client authenticates with the ",(0,r.jsx)(n.strong,{children:"bridge agent's identity"})," (attestation). It does ",(0,r.jsx)(n.strong,{children:"not"})," read ",(0,r.jsx)(n.code,{children:"UAGENTS_MAILBOX_KEY"})," (that name is not used by ",(0,r.jsx)(n.code,{children:"uagents_adapter"})," or the mailbox client)."]}),"\n",(0,r.jsxs)(n.p,{children:["Do this ",(0,r.jsx)(n.strong,{children:"before"}
1)," you start the Python processes:"]}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:["Create an Agentverse account and (optional) an API key for other Agentverse HTTP APIs: ",(0,r.jsx)(n.a,{href:"/docs/agentverse/agentverse-api-key",children:"Agentverse API key"}),". ",(0,r.jsxs)(n.strong,{children:[(0,r.jsx)(n.code,{children:"AGENTVERSE_API_KEY"})," is not required"]})," for this inbound bridge to poll mailbox; use it only if you call Agentverse REST APIs yourself."]}),"\n",(0,r.jsxs)(n.li,{children:["After the adapter prints an inspector URL, open it while logged in and choose ",(0,r.jsx)(n.strong,{children:"Connect \u2192 Mailbox"}),". See ",(0,r.jsx)(n.a,{href:"/docs/agent-creation/uagent-creation#mailbox-agents",children:"Mailbox agents"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:["Set a ",(0,r.jsx)(n.strong,{children:"unique"})," ",(0,r.jsx)(n.code,{children:"UAGENTS_BRIDGE_SEED"})," per bridge so the bridge address is stable. Almanac/agent ",(0,r.jsx)(n.strong,{children:"names"})," must also be unique if you run more than one copy."]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:'# macOS / Linux\nexport UAGENTS_BRIDGE_SEED="perplexity_bridge_seed_2024"\n'})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-powershell",children:'# Windows PowerShell\n$env:UAGENTS_BRIDGE_SEED = "perplexity_bridge_seed_2024"\n'})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",metastring:'title=".env.example"',children:"# Unique per process. Never commit real seeds or keys.\nUAGENTS_BRIDGE_SEED=replace_with_your_unique_seed\n\n# Optional: Agentverse REST APIs only (not mailbox polling)\n# AGENTVERSE_API_KEY=your_agentverse_api_key\n"})}),"\n",(0,r.jsxs)(n.p,{children:["Load ",(0,r.jsx)(n.code,{children:".env"})," with ",(0,r.jsx)(n.code,{children:"python-dotenv"})," as shown in the scripts below."]}),"\n",(0,r.jsx)(n.h2,{id:"step-3-choose-your-agents",children:"Step 3: Choose your agents"}),"\n",(0,r.jsx)(n.p,{children:"Two options:"}),"\n",(0,r.jsx)(n.h3,{id:"option-a-marketplace-agents",children:"Option A: Marketplace agents"}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:["Open ",(0,r.jsx)(n.a,{href:"https://agentverse.ai",children:"Agentverse"})," and browse the marketplace."]}),"\n",(0,r.jsx)(n.li,{children:"Copy the agent address from the profile."}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Health check:"})," open Agentverse chat (or ",(0,r.jsxs)(n.a,{href:"https://chat.asi1.ai/",children:["ASI",":One"]}),") and confirm the agent replies ",(0,r.jsx)(n.strong,{children:"before"})," you start a bridge."]}),"\n"]}),"\n",(0,r.jsx)(n.h3,{id:"option-b-your-own-uagents",children:"Option B: Your own uAgents"}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:["Create agents with the ",(0,r.jsx)(n.a,{href:"/docs/agent-creation/uagent-creation",children:"uAgents framework"}),"."]}),"\n",(0,r.jsx)(n.li,{children:"Register them on Agentverse and keep them running."}),"\n",(0,r.jsx)(n.li,{children:"Copy addresses and test chat the same way."}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"This tutorial"})," uses these marketplace addresses as ",(0,r.jsx)(n.strong,{children:"examples"}),". They may go inactive. Prefer placeholders you verified in Option A:"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["Perplexity Search: ",(0,r.jsx)(n.code,{children:"agent1qgzd0c60d4c5n37m4pzuclv5p9vwsftmfkznksec3drux8qnhmvuymsmshp"})]}),"\n",(0,r.jsxs)(n.li,{children:["Finance Q&A: ",(0,r.jsx)(n.code,{children:"agent1qdv2qgxucvqatam6nv28qp202f3pw8xqpfm8man6zyegztuzd2t6yem9evl"})]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["Replace ",(0,r.jsx)(n.code,{children:"YOUR_PERPLEXITY_AGENT_ADDRESS"})," / ",(0,r.jsx)(n.code,{children:"YOUR_FINANCE_AGENT_ADDRESS"})," in the scripts if those marketplace agents do not respond."]}),"\n",(0,r.jsx)(n.admonition,{title:"Unique name and seed",type:"warning",children:(0,r.jsxs)(n.p,{children:["Use a ",(0,r.jsxs)(n.strong,{children:["unique agent name and ",(0,r.jsx)(n.code,{children:"UAGENTS_BRIDGE_SEED"})," for every bridge"]})," you run. Shared names collide on Almanac. The two sample seeds below are already different (",(0,r.jsx)(n.code,{children:"perplexity_bridge_seed_2024"})," vs ",(0,r.jsx)(n.code,{children:"finance_bridge_seed_2024"}),") and produce ",(0,r.jsx)(n.strong,{children:"different"})," bridge addresses."]})}),"\n",(0,r.jsx)(n.h2,{id:"step-4-build-the-adapter-scripts",children:"Step 4: Build the adapter scripts"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"A2ARegisterTool.invoke()"})," starts uvicorn and ",(0,r.jsx)(n.strong,{children:"blocks until you press Ctrl+C"}),". There is no success ",(0,r.jsx)(n.code,{children:"while True: time.sleep(1)"})," after a normal start \u2014 that loop never runs while the server is up. Match the ",(0,r.jsx)(n.a,{href:"https://github.com/fetchai/uAgents/blob/main/python/uagents-adapter/src/uagents_adapter/a2a_inbound/README.md",children:"package README"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"perplexity-search-agent",children:"Perplexity Search Agent"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-python",metastring:'title="perplexity_adapter.py"',children:'import logging\nimport os\nimport sys\n\nfrom dotenv import load_dotenv\nfrom uagents_adapter import A2ARegisterTool\n\nload_dotenv()\n\nlogging.basicConfig(level=logging.INFO)\n\ndef main() -> int:\n """Start A2A bridge for Perplexity Search Agent."""\n os.environ.setdefault("UAGENTS_BRIDGE_SEED", "perplexity_bridge_seed_2024")\n\n config = {\n "agent_address": os.environ.get(\n "TARGET_AGENT_ADDRESS",\n "agent1qgzd0c60d4c5n37m4pzuclv5p9vwsftmfkznksec3drux8qnhmvuymsmshp",\n ),\n "name": "Perplexity Search Agent",\n "description": "AI-powered web search and research assistant with real-time information access",\n "skill_tags": ["search", "research", "web", "ai", "information", "news"],\n "skill_examples": [\n "Search for latest AI news",\n "Research quantum computing trends",\n "Find information about climate change",\n ],\n "port": 9002,\n "bridge_port": 8002,\n "host": "localhost",\n }\n\n adapter = A2ARegisterTool()\n # Blocks in uvicorn.run() until Ctrl+C.\n result = adapter.invoke(config)\n if result.get("success") is False:\n print(f"Failed to start bridge: {result}")\n return 1\n return 0\n\nif __name__ == "__main__":\n sys.exit(main())\n'})}),"\n",(0,r.jsx)(n.h3,{id:"finance-qa-agent",children:"Finance Q&A Agent"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-python",metastring:'title="finance_adapter.py"',children:'import logging\nimport os\nimport sys\n\nfrom dotenv import load_dotenv\nfrom uagents_adapter import A2ARegisterTool\n\nload_dotenv()\n\nlogging.basicConfig(level=logging.INFO)\n\ndef main() -> int:\n """Start A2A bridge for Finance Q&A Agent."""\n os.environ.setdefault("UAGENTS_BRIDGE_SEED", "finance_bridge_seed_2024")\n\n config = {\n "agent_address": os.environ.get(\n "TARGET_AGENT_ADDRESS",\n "agent1qdv2qgxucvqatam6nv28qp202f3pw8xqpfm8man6zyegztuzd2t6yem9evl",\n ),\n "name": "Finance Q&A Agent",\n "description": "AI-powered financial advisor and Q&A assistant for investment, budgeting, and financial planning guidance",\n "skill_tags": ["finance", "investment", "budgeting", "financial_planning", "assistance"],\n "skill_examples": [\n "Analyze AAPL stock performance",\n "Compare crypto portfolios",\n "Budget planning advice",\n ],\n "port": 9003,\n "bridge_port": 8003,\n "host": "localhost",\n }\n\n adapter = A2ARegisterTool()\n # Blocks in uvicorn.run() until Ctrl+C.\n result = adapter.invoke(config)\n if result.get("success") is False:\n print(f"Failed to start bridge: {result}")\n return 1\n return 0\n\nif __name__ == "__main__":\n sys.exit(main())\n'})}),"\n",(0,r.jsxs)(n.p,{children:["For DEBUG logs, change ",(0,r.jsx)(n.code,{children:"logging.basicConfig(level=logging.INFO)"})," to ",(0,r.jsx)(n.code,{children:"logging.DEBUG"})," in the same file (there is no ",(0,r.jsx)(n.code,{children:"--verbose"})," flag on ",(0,r.jsx)(n.code,{children:"A2ARegisterTool.invoke()"}),")."]}
1),"\n",(0,r.jsx)(n.h2,{id:"step-5-run-the-adapters",children:"Step 5: Run the adapters"}),"\n",(0,r.jsx)(n.h3,{id:"terminal-1-perplexity",children:"Terminal 1: Perplexity"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:"python perplexity_adapter.py\n"})}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Expected output"})," (your process id and timestamps will differ). With seed ",(0,r.jsx)(n.code,{children:"perplexity_bridge_seed_2024"})," and bridge port ",(0,r.jsx)(n.code,{children:"8002"}),", the bridge address is:"]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.code,{children:"agent1qvdrt7kqg2k67czm8wzs724jv63fsq5cr2lq4mymtptj576sdpu9yngzden"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"INFO:root:\ud83d\udd17 Using provided bridge port: 8002\nINFO:uagents_adapter.a2a_inbound.agentverse_executor:\ud83d\udd10 Using user-provided bridge seed from environment\nINFO: [a2a_agentverse_bridge]: Starting agent with address: agent1qvdrt7kqg2k67czm8wzs724jv63fsq5cr2lq4mymtptj576sdpu9yngzden\nINFO:uagents_adapter.a2a_inbound.agentverse_executor:A2A Bridge agent started with address: agent1qvdrt7kqg2k67czm8wzs724jv63fsq5cr2lq4mymtptj576sdpu9yngzden\nINFO:uagents_adapter.a2a_inbound.agentverse_executor:Target Agentverse agent: agent1qgzd0c60d4c5n37m4pzuclv5p9vwsftmfkznksec3drux8qnhmvuymsmshp\nINFO: [a2a_agentverse_bridge]: Agent inspector available at https://agentverse.ai/inspect/?uri=http%3A//127.0.0.1%3A8002&address=agent1qvdrt7kqg2k67czm8wzs724jv63fsq5cr2lq4mymtptj576sdpu9yngzden\nINFO: [a2a_agentverse_bridge]: Starting server on http://0.0.0.0:8002 (Press CTRL+C to quit)\nINFO: [a2a_agentverse_bridge]: Starting mailbox client for https://agentverse.ai\nINFO: [a2a_agentverse_bridge]: Mailbox access token acquired\nINFO: [uagents.registration]: Registration on Almanac API successful\nINFO:uagents_adapter.a2a_inbound.agentverse_executor:\u2705 A2A Bridge to Agentverse started successfully\nINFO:root:\ud83d\ude80 A2A server starting on localhost:9002\nINFO:root:\ud83d\udd17 Bridging to Agentverse agent: agent1qgzd0c60d4c5n37m4pzuclv5p9vwsftmfkznksec3drux8qnhmvuymsmshp\nINFO:root:\ud83d\udccb Agent name: Perplexity Search Agent\nINFO:root:\ud83c\udff7\ufe0f Tags: search, research, web, ai, information, news\nINFO: Started server process [14746]\n"})}),"\n",(0,r.jsxs)(n.p,{children:["Open the ",(0,r.jsx)(n.strong,{children:"inspector URL"})," (bridge port ",(0,r.jsx)(n.strong,{children:"8002"}),") and connect ",(0,r.jsx)(n.strong,{children:"Mailbox"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"terminal-2-finance",children:"Terminal 2: Finance"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:"python finance_adapter.py\n"})}),"\n",(0,r.jsxs)(n.p,{children:["With seed ",(0,r.jsx)(n.code,{children:"finance_bridge_seed_2024"})," and bridge port ",(0,r.jsx)(n.code,{children:"8003"}),", the bridge address is ",(0,r.jsx)(n.strong,{children:"different"}),":"]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.code,{children:"agent1qdv8n2zucf50mvyzxwswe02swnwzmt5fctyeug6cewdkaz4wjd46qjggnz2"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"INFO:root:\ud83d\udd17 Using provided bridge port: 8003\nINFO:uagents_adapter.a2a_inbound.agentverse_executor:\ud83d\udd10 Using user-provided bridge seed from environment\nINFO: [a2a_agentverse_bridge]: Starting agent with address: agent1qvdrt7kqg2k67czm8wzs724jv63fsq5cr2lq4mymtptj576sdpu9yngzden\nINFO:uagents_adapter.a2a_inbound.agentverse_executor:A2A Bridge agent started with address: agent1qvdrt7kqg2k67czm8wzs724jv63fsq5cr2lq4mymtptj576sdpu9yngzden\nINFO:uagents_adapter.a2a_inbound.agentverse_executor:Target Agentverse agent: agent1qdv2qgxucvqatam6nv28qp202f3pw8xqpfm8man6zyegztuzd2t6yem9evl\nINFO: [a2a_agentverse_bridge]: Agent inspector available at https://agentverse.ai/inspect/?uri=http%3A//127.0.0.1%3A8003&address=agent1qvdrt7kqg2k67czm8wzs724jv63fsq5cr2lq4mymtptj576sdpu9yngzden\nINFO: [a2a_agentverse_bridge]: Starting server on http://0.0.0.0:8003 (Press CTRL+C to quit)\nINFO: [a2a_agentverse_bridge]: Starting mailbox client for https://agentverse.ai\nINFO: [a2a_agentverse_bridge]: Mailbox access token acquired\nINFO: [uagents.registration]: Registration on Almanac API successful\nINFO:uagents_adapter.a2a_inbound.agentverse_executor:\u2705 A2A Bridge to Agentverse started successfully\nINFO:root:\ud83d\ude80 A2A server starting on localhost:9003\nINFO:root:\ud83d\udd17 Bridging to Agentverse agent: agent1qdv2qgxucvqatam6nv28qp202f3pw8xqpfm8man6zyegztuzd2t6yem9evl\nINFO:root:\ud83d\udccb Agent name: Finance Q&A Agent\nINFO:root:\ud83c\udff7\ufe0f Tags: finance, investment, budgeting, financial_planning, assistance\nINFO: Started server process [14747]\n"})}),"\n",(0,r.jsxs)(n.p,{children:["Connect Mailbox on the Finance inspector URL (bridge port ",(0,r.jsx)(n.strong,{children:"8003"}),")."]}),"\n",(0,r.jsx)(n.h2,{id:"step-6-test-with-a2a-json-rpc",children:"Step 6: Test with A2A JSON-RPC"}),"\n",(0,r.jsxs)(n.p,{children:["This adapter serves ",(0,r.jsx)(n.strong,{children:(0,r.jsx)(n.code,{children:"A2AStarletteApplication"})})," (JSON-RPC on ",(0,r.jsx)(n.code,{children:"/"}),"). There is ",(0,r.jsx)(n.strong,{children:"no"})," ",(0,r.jsx)(n.code,{children:"POST /chat"})," route. Do not send ",(0,r.jsx)(n.code,{children:'{ "message", "session_id" }'}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["Use ",(0,r.jsx)(n.code,{children:"message/send"})," as in the ",(0,r.jsx)(n.a,{href:"https://github.com/fetchai/uAgents/blob/main/python/uagents-adapter/src/uagents_adapter/a2a_inbound/README.md",children:"inbound adapter README"})," and ",(0,r.jsx)(n.a,{href:"https://a2a-protocol.org/",children:"A2A protocol docs"}),"."]}),"\n",(0,r.jsx)(n.p,{children:"JSON-RPC over HTTP (macOS / Linux):"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:'curl -X POST http://localhost:9002/ \\\n -H "Content-Type: application/json" \\\n -d \'{"jsonrpc":"2.0","id":"test-1","method":"message/send","params":{"message":{"role":"user","parts":[{"kind":"text","text":"What are the latest developments in quantum computing?"}],"messageId":"msg-1"},"contextId":"test_session_1"}}\'\n'})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:'curl -X POST http://localhost:9003/ \\\n -H "Content-Type: application/json" \\\n -d \'{"jsonrpc":"2.0","id":"test-2","method":"message/send","params":{"message":{"role":"user","parts":[{"kind":"text","text":"What should I consider when investing in tech stocks?"}],"messageId":"msg-2"},"contextId":"test_session_2"}}\'\n'})}),"\n",(0,r.jsxs)(n.p,{children:["Single-line fallback (Windows PowerShell \u2014 use ",(0,r.jsx)(n.code,{children:"curl.exe"})," so it is not ",(0,r.jsx)(n.code,{children:"Invoke-WebRequest"}),"):"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-powershell",children:'curl.exe -X POST http://localhost:9002/ -H "Content-Type: application/json" -d "{\\"jsonrpc\\":\\"2.0\\",\\"id\\":\\"test-1\\",\\"method\\":\\"message/send\\",\\"params\\":{\\"message\\":{\\"role\\":\\"user\\",\\"parts\\":[{\\"kind\\":\\"text\\",\\"text\\":\\"What are the latest developments in quantum computing?\\"}],\\"messageId\\":\\"msg-1\\"},\\"contextId\\":\\"test_session_1\\"}}"\n'})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-powershell",children:'curl.exe -X POST http://localhost:9003/ -H "Content-Type: application/json" -d "{\\"jsonrpc\\":\\"2.0\\",\\"id\\":\\"test-2\\",\\"method\\":\\"message/send\\",\\"params\\":{\\"message\\":{\\"role\\":\\"user\\",\\"parts\\":[{\\"kind\\":\\"text\\",\\"text\\":\\"What should I consider when investing in tech stocks?\\"}],\\"messageId\\":\\"msg-2\\"},\\"contextId\\":\\"test_session_2\\"}}"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["REST ",(0,r.jsx)(n.code,{children:"POST /v1/message:send"})," exists on ",(0,r.jsx)(n.strong,{children:"a2a-sdk REST apps"}
1),". This inbound adapter uses JSON-RPC Starlette, so use ",(0,r.jsx)(n.code,{children:"POST /"})," + ",(0,r.jsx)(n.code,{children:'method: "message/send"'})," as above."]}),"\n",(0,r.jsx)(n.h2,{id:"step-7-discover-agent-cards",children:"Step 7: Discover agent cards"}),"\n",(0,r.jsxs)(n.p,{children:["Current A2A SDK well-known path (",(0,r.jsx)(n.code,{children:"AGENT_CARD_WELL_KNOWN_PATH"}),"):"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.code,{children:"http://localhost:9002/.well-known/agent-card.json"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.code,{children:"http://localhost:9003/.well-known/agent-card.json"})}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["Compatibility fallback (",(0,r.jsx)(n.code,{children:"PREV_AGENT_CARD_WELL_KNOWN_PATH"}),", older clients):"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.code,{children:"http://localhost:9002/.well-known/agent.json"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.code,{children:"http://localhost:9003/.well-known/agent.json"})}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:"curl http://localhost:9002/.well-known/agent-card.json\ncurl http://localhost:9003/.well-known/agent-card.json\n"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-powershell",children:"curl.exe http://localhost:9002/.well-known/agent-card.json\ncurl.exe http://localhost:9003/.well-known/agent-card.json\n"})}),"\n",(0,r.jsx)(n.p,{children:"Point any A2A client at those URLs. There is still no shared discovery/coordination between the two bridges unless you add a client that calls both."}),"\n",(0,r.jsx)(n.h2,{id:"production",children:"Production"}),"\n",(0,r.jsxs)(n.p,{children:["Verified environment variables for ",(0,r.jsx)(n.strong,{children:"this"})," adapter:"]}),"\n",(0,r.jsxs)(n.table,{children:[(0,r.jsx)(n.thead,{children:(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.th,{children:"Variable"}),(0,r.jsx)(n.th,{children:"Used by"}),(0,r.jsx)(n.th,{children:"Required"})]})}),(0,r.jsxs)(n.tbody,{children:[(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"UAGENTS_BRIDGE_SEED"})}),(0,r.jsx)(n.td,{children:"Inbound adapter / bridge identity"}),(0,r.jsx)(n.td,{children:"Recommended (stable address)"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"AGENTVERSE_API_KEY"})}),(0,r.jsxs)(n.td,{children:["Other Agentverse REST flows; ",(0,r.jsx)(n.strong,{children:"not"})," mailbox poll"]}),(0,r.jsx)(n.td,{children:"Optional"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"UAGENTS_MAILBOX_KEY"})}),(0,r.jsxs)(n.td,{children:[(0,r.jsx)(n.strong,{children:"Not used"})," \u2014 do not set this expecting mailbox auth"]}),(0,r.jsx)(n.td,{children:"\u2014"})]})]})]}),"\n",(0,r.jsx)(n.p,{children:"macOS / Linux:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:'export UAGENTS_BRIDGE_SEED="your_secure_unique_seed"\n# optional\nexport AGENTVERSE_API_KEY="your_agentverse_api_key"\n'})}),"\n",(0,r.jsx)(n.p,{children:"Windows PowerShell:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-powershell",children:'$env:UAGENTS_BRIDGE_SEED = "your_secure_unique_seed"\n# optional\n$env:AGENTVERSE_API_KEY = "your_agentverse_api_key"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["Mailbox setup remains: inspector ",(0,r.jsx)(n.strong,{children:"Connect \u2192 Mailbox"}),". See ",(0,r.jsx)(n.a,{href:"/docs/agent-creation/uagent-creation#mailbox-agents",children:"Mailbox agents"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"security",children:"Security"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"Unique seeds and names per bridge"}),"\n",(0,r.jsx)(n.li,{children:"Do not commit seeds or API keys"}),"\n",(0,r.jsx)(n.li,{children:"Restrict who can reach the A2A HTTP ports"}),"\n"]}),"\n",(0,r.jsx)(n.h3,{id:"scaling",children:"Scaling"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"Reverse proxy in front of A2A ports"}),"\n",(0,r.jsxs)(n.li,{children:["Health-check ",(0,r.jsx)(n.code,{children:"/.well-known/agent-card.json"})," and JSON-RPC"]}),"\n",(0,r.jsx)(n.li,{children:"One process per target agent (this sample is two processes, not a cluster)"}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"troubleshooting",children:"Troubleshooting"}),"\n",(0,r.jsxs)(n.table,{children:[(0,r.jsx)(n.thead,{children:(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.th,{children:"Symptom"}),(0,r.jsx)(n.th,{children:"What to check"})]})}),(0,r.jsxs)(n.tbody,{children:[(0,r.jsxs)(n.tr,{children:[(0,r.jsxs)(n.td,{children:[(0,r.jsx)(n.code,{children:"404"})," on ",(0,r.jsx)(n.code,{children:"/chat"})]}),(0,r.jsxs)(n.td,{children:["Use JSON-RPC ",(0,r.jsx)(n.code,{children:"POST /"})," with ",(0,r.jsx)(n.code,{children:"message/send"})]})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:"Mailbox warning / no replies"}),(0,r.jsx)(n.td,{children:"Inspector \u2192 Connect \u2192 Mailbox; target agent must be active in Agentverse chat"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:"Port already in use"}),(0,r.jsx)(n.td,{children:"Free 9002, 9003, 8002, 8003"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:"Bridge address changes every restart"}),(0,r.jsxs)(n.td,{children:["Set ",(0,r.jsx)(n.code,{children:"UAGENTS_BRIDGE_SEED"})]})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsxs)(n.td,{children:["Finance logs show Perplexity's ",(0,r.jsx)(n.code,{children:"agent1qvdrt7k\u2026"})]}),(0,r.jsxs)(n.td,{children:["Wrong seed copied; Finance must be ",(0,r.jsx)(n.code,{children:"agent1qdv8n2z\u2026"})," with ",(0,r.jsx)(n.code,{children:"finance_bridge_seed_2024"})]})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsxs)(n.td,{children:[(0,r.jsx)(n.code,{children:"UnicodeEncodeError"})," on Windows"]}),(0,r.jsxs)(n.td,{children:["UTF-8 code page / ",(0,r.jsx)(n.code,{children:"PYTHONIOENCODING=utf-8"})]})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsxs)(n.td,{children:["Copy-paste ",(0,r.jsx)(n.code,{children:"SyntaxError"})," (",(0,r.jsx)(n.code,{children:"import osimport"}),")"]}),(0,r.jsxs)(n.td,{children:["Copy the fenced block with language + ",(0,r.jsx)(n.code,{children:"title="}),", not stripped HTML"]})]})]})]}),"\n",(0,r.jsx)(n.h2,{id:"next-steps",children:"Next steps"}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:["Add more ",(0,r.jsx)(n.strong,{children:"independent"})," adapter processes (new ports, new seeds)."]}),"\n",(0,r.jsxs)(n.li,{children:["Build an A2A ",(0,r.jsx)(n.strong,{children:"client"}
1)," that calls both endpoints (that is where \u201ccoordination\u201d lives \u2014 not in these scripts)."]}),"\n",(0,r.jsxs)(n.li,{children:["For a ready-made inbound ",(0,r.jsx)(n.strong,{children:"planner"}),", clone ",(0,r.jsx)(n.a,{href:"https://github.com/fetchai/innovation-lab-examples/tree/main/a2a-uAgents-Integration/a2a-Inbound-Communication/Multiagent-Planner",children:"Multiagent Planner"}),"."]}),"\n",(0,r.jsx)(n.li,{children:"Deploy with monitoring on both the A2A port and the bridge port."}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"resources",children:"Resources"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/docs/A2A-Integration/what-is-a2a",children:"What is A2A? (Innovation Lab)"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/docs/agent-creation/uagents-adapter-guide",children:"uAgents Adapter guide"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://github.com/fetchai/uAgents/blob/main/python/uagents-adapter/src/uagents_adapter/a2a_inbound/README.md",children:"A2A inbound adapter README (GitHub)"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://pypi.org/project/uagents-adapter/",children:"uagents-adapter on PyPI"})}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.a,{href:"https://a2a.dev",children:"A2A protocol"})," and ",(0,r.jsx)(n.a,{href:"https://a2a-protocol.org/",children:"A2A SDK docs"})]}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://docs.uagents.ai",children:"uAgents framework"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://agentverse.ai",children:"Agentverse"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://github.com/fetchai/innovation-lab-examples/tree/main/a2a-uAgents-Integration/a2a-Inbound-Communication",children:"innovation-lab-examples inbound A2A"})}),"\n"]})]})}function h(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},28453:(e,n,s)=>{s.d(n,{R:()=>a,x:()=>d});var t=s(96540);const r={},i=t.createContext(r);function a(e){const n=t.useContext(i);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function d(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:a(e.components),t.createElement(i.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.