PageSourceSearch

https://innovationlab.fetch.ai/resources/assets/js/2b886cd7.a067492f.js

js fetch.ai collected 2026-09-24 09:38:39 UTC 9,553 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkinnovation_labs=self.webpackChunkinnovation_labs||[]).push([[937],{41377:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>o,default:()=>h,frontMatter:()=>i,metadata:()=>a,toc:()=>c});const a=JSON.parse('{"id":"agent-creation/uagents-adapter-guide","title":"uAgents Adapters","description":"uAgents Adapters provide a bridge between the uAgents ecosystem and various agentic frameworks, enabling seamless communication between different AI agent architectures.","source":"@site/versioned_docs/version-1.0.3/agent-creation/uagents-adapter-guide.md","sourceDirName":"agent-creation","slug":"/agent-creation/uagents-adapter-guide","permalink":"/resources/docs/1.0.3/agent-creation/uagents-adapter-guide","draft":false,"unlisted":false,"tags":[],"version":"1.0.3","frontMatter":{"id":"uagents-adapter-guide","title":"uAgents Adapters"},"sidebar":"tutorialSidebar","previous":{"title":"AI Agent Creation","permalink":"/resources/docs/1.0.3/agent-creation/sdk-creation"},"next":{"title":"uAgent to uAgent Communication","permalink":"/resources/docs/1.0.3/agent-communication/uagent-uagent-communication"}}');var r=t(74848),s=t(28453);const i={id:"uagents-adapter-guide",title:"uAgents Adapters"},o="uAgents Adapters: Connecting AI Framework Ecosystems",d={},c=[{value:"Why Use Adapters?",id:"why-use-adapters",level:2},{value:"Available Adapters",id:"available-adapters",level:2},{value:"1. LangChain Adapter",id:"1-langchain-adapter",level:3},{value:"2. LangGraph Adapter",id:"2-langgraph-adapter",level:3},{value:"3. CrewAI Adapter",id:"3-crewai-adapter",level:3},{value:"Common Parameters",id:"common-parameters",level:2},{value:"Communication Protocol",id:"communication-protocol",level:2},{value:"Cleanup and Management",id:"cleanup-and-management",level:2},{value:"Next Steps",id:"next-steps",level:2}];function l(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,s.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.header,{children:(0,r.jsx)(n.h1,{id:"uagents-adapters-connecting-ai-framework-ecosystems",children:"uAgents Adapters: Connecting AI Framework Ecosystems"})}),"\n",(0,r.jsx)(n.p,{children:"uAgents Adapters provide a bridge between the uAgents ecosystem and various agentic frameworks, enabling seamless communication between different AI agent architectures."}),"\n",(0,r.jsx)(n.h2,{id:"why-use-adapters",children:"Why Use Adapters?"}),"\n",(0,r.jsx)(n.p,{children:"AI development landscapes often involve multiple frameworks and technologies, each with their own strengths:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"LangChain"}),": Powerful for composing LLMs with tools and chains"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"LangGraph"}),": Excellent for complex orchestration and stateful workflows"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"CrewAI"}),": Specialized for multi-agent collaborative systems"]}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"The uAgents Adapter package allows you to leverage these specialized frameworks while still benefiting from the uAgents ecosystem for communication, discovery, and deployment."}),"\n",(0,r.jsx)(n.h2,{id:"available-adapters",children:"Available Adapters"}),"\n",(0,r.jsx)(n.p,{children:"The uAgents Adapter package currently supports several major AI frameworks:"}),"\n",(0,r.jsx)(n.h3,{id:"1-langchain-adapter",children:"1. LangChain Adapter"}),"\n",(0,r.jsx)(n.p,{children:"Connect LangChain agents, chains, and tools to the uAgents ecosystem."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-python",children:'from uagents_adapter import LangchainRegisterTool\n\n# Register a LangChain agent as a uAgent\ntool = LangchainRegisterTool()\nagent_info = tool.invoke({\n    "agent_obj": langchain_agent,\n    "name": "my_langchain_agent",\n    "port": 8000,\n    "description": "A LangChain agent powered by GPT-4",\n    "api_token": AGENTVERSE_API_KEY\n})\n'})}),"\n",(0,r.jsx)(n.h3,{id:"2-langgraph-adapter",children:"2. LangGraph Adapter"}),"\n",(0,r.jsx)(n.p,{children:"Integrate LangGraph's powerful orchestration with uAgents."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-python",children:'from uagents_adapter import LangchainRegisterTool\n\n# Wrap LangGraph agent function for uAgent integration\ndef langgraph_agent_func(query):\n    # Process with LangGraph\n    result = langgraph_app.invoke(query)\n    return result\n\n# Register the LangGraph function as a uAgent\ntool = LangchainRegisterTool()\nagent_info = tool.invoke({\n    "agent_obj": langgraph_agent_func,\n    "name": "my_langgraph_agent",\n    "port": 8080,\n    "description": "A LangGraph orchestration agent",\n    "api_token": AGENTVERSE_API_KEY\n})\n'})}),"\n",(0,r.jsx)(n.h3,{id:"3-crewai-adapter",children:"3. CrewAI Adapter"}),"\n",(0,r.jsx)(n.p,{children:"Expose CrewAI's collaborative agent teams as uAgents."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-python",children:'from uagents_adapter import CrewaiRegisterTool\n\n# Create a function to handle CrewAI operations\ndef crew_handler(query):\n    # Process with CrewAI\n    result = my_crew.kickoff(inputs={"query": query})\n    return result\n\n# Register the CrewAI function as a uAgent\ntool = CrewaiRegisterTool()\nagent_info = tool.invoke({\n    "agent_obj": crew_handler,\n    "name": "my_crew_agent",\n    "port": 8081,\n    "description": "A CrewAI team of specialized agents",\n    "api_token": AGENTVERSE_API_KEY\n})\n'})}),"\n",(0,r.jsx)(n.h2,{id:"common-parameters",children:"Common Parameters"}),"\n",(0,r.jsx)(n.p,{children:"All adapters accept the following parameters:"}),"\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:"Parameter"}),(0,r.jsx)(n.th,{children:"Type"}),(0,r.jsx)(n.th,{children:"Description"})]})}),(0,r.jsxs)(n.tbody,{children:[(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"agent_obj"})}),(0,r.jsx)(n.td,{children:"object"}),(0,r.jsx)(n.td,{children:"The framework-specific agent or function to wrap"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"name"})}),(0,r.jsx)(n.td,{children:"string"}),(0,r.jsx)(n.td,{children:"Name for your agent in the uAgents ecosystem"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"port"})}),(0,r.jsx)(n.td,{children:"int"}),(0,r.jsx)(n.td,{children:"Port for the agent's HTTP server"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"description"})}),(0,r.jsx)(n.td,{children:"string"}),(0,r.jsx)(n.td,{children:"Human-readable description of agent capabilities"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"api_token"})}),(0,r.jsx)(n.td,{children:"string"}),(0,r.jsx)(n.td,{children:"Your Agentverse API key for registration"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"mailbox"})}),(0,r.jsx)(n.td,{children:"bool"}),(0,r.jsx)(n.td,{children:"Whether to use Agentverse mailbox for persistence (optional)"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"ai_agent_address"})}),(0,r.jsx)(n.td,{children:"string"}),(0,r.jsx)(n.td,{children:"AI Agent address to conver Natural language into structured query prompt (optional)"})]})]})]}),"\n",(0,r.jsx)(n.h2,{id:"communication-protocol",children:"Communication Protocol"}),"\n",(0,r.jsx)(n.p,{children:"Once registered, adapter agents communicate using the uAgents chat protocol:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-python",children:'from uagents_core.contrib.protocols.chat import (\n    ChatMessage, TextContent\n)\n\n# Send a message to an adapter-wrapped agent\nmessage = ChatMessage(\n    timestamp=datetime.utcnow(),\n    msg_id=uuid4(),\n    content=[TextContent(type="text", text="Your query here")]\n)\nawait ctx.send(adapter_agent_address, message)\n'})}),"\n",(0,r.jsx)(n.h2,{id:"cleanup-and-management",children:"Cleanup and Management"}),"\n",(0,r.jsx)(n.p,{children:"Always clean up your agents when shutting down to ensure proper deregistration:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-python",children:'from uagents_adapter import 
1cleanup_uagent\n\ntry:\n    # Your agent code here\n    while True:\n        time.sleep(1)\nexcept KeyboardInterrupt:\n    # Clean up the agent\n    cleanup_uagent("your_agent_name")\n    print("Agent stopped.")\n'})}),"\n",(0,r.jsx)(n.h2,{id:"next-steps",children:"Next Steps"}),"\n",(0,r.jsxs)(n.p,{children:["To explore concrete examples of adapter usage, refer to the ",(0,r.jsx)(n.a,{href:"/docs/examples/adapters/crewai-adapter-example",children:"uAgents Adapter Examples"})," section."]})]})}function h(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},28453:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>o});var a=t(96540);const r={},s=a.createContext(r);function i(e){const n=a.useContext(s);return a.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),a.createElement(s.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.