Skip to main content
Version: Next

uAgents Adapters: Connecting AI Framework Ecosystems

uAgents Adapters provide a bridge between the uAgents ecosystem and various agentic frameworks, enabling seamless communication between different AI agent architectures.

Why Use Adapters?

AI development landscapes often involve multiple frameworks and technologies, each with their own strengths:

  • LangChain: Powerful for composing LLMs with tools and chains
  • LangGraph: Excellent for complex orchestration and stateful workflows
  • CrewAI: Specialized for multi-agent collaborative systems
  • MCP Server Adapter: The MCP Server Adapter allows you to host your MCP Servers on Agentverse and get discovered by ASI:One by enabling Chat Protocol.

The uAgents Adapter package allows you to leverage these specialized frameworks while still benefiting from the uAgents ecosystem for communication, discovery, and deployment.

Installation

Install the base package:

pip install uagents-adapter

Install with specific framework support:

# Install with LangChain support
pip install "uagents-adapter[langchain]"

# Install with CrewAI support
pip install "uagents-adapter[crewai]"

# Install with MCP support
pip install "uagents-adapter[mcp]"

# Install with A2A Inbound support
pip install "uagents-adapter[a2a-inbound]"

# Install with all extras
pip install "uagents-adapter[all]"

Available Adapters

The uAgents Adapter package currently supports several major AI frameworks:

1. LangChain Adapter

Connect LangChain agents, chains, and tools to the uAgents ecosystem.

Installation:

pip install "uagents-adapter[langchain]"
from uagents_adapter import LangchainRegisterTool

# Register a LangChain agent as a uAgent
tool = LangchainRegisterTool()
agent_info = tool.invoke({
"agent_obj": langchain_agent,
"name": "my_langchain_agent",
"port": 8000,
"description": "A LangChain agent powered by GPT-4",
"api_token": AGENTVERSE_API_KEY
})

2. LangGraph Adapter

Integrate LangGraph's powerful orchestration with uAgents.

Installation:

pip install "uagents-adapter[langchain]"
from uagents_adapter import LangchainRegisterTool

# Wrap LangGraph agent function for uAgent integration
def langgraph_agent_func(query):
# Process with LangGraph
result = langgraph_app.invoke(query)
return result

# Register the LangGraph function as a uAgent
tool = LangchainRegisterTool()
agent_info = tool.invoke({
"agent_obj": langgraph_agent_func,
"name": "my_langgraph_agent",
"port": 8080,
"description": "A LangGraph orchestration agent",
"api_token": AGENTVERSE_API_KEY
})

3. CrewAI Adapter

Expose CrewAI's collaborative agent teams as uAgents.

Installation:

pip install "uagents-adapter[crewai]"
from uagents_adapter import CrewaiRegisterTool

# Create a function to handle CrewAI operations
def crew_handler(query):
# Process with CrewAI
result = my_crew.kickoff(inputs={"query": query})
return result

# Register the CrewAI function as a uAgent
tool = CrewaiRegisterTool()
agent_info = tool.invoke({
"agent_obj": crew_handler,
"name": "my_crew_agent",
"port": 8081,
"description": "A CrewAI team of specialized agents",
"api_token": AGENTVERSE_API_KEY
})

Common Parameters

All adapters accept the following parameters:

ParameterTypeDescription
agent_objobjectThe framework-specific agent or function to wrap
namestringName for your agent in the uAgents ecosystem
portintPort for the agent's HTTP server
descriptionstringHuman-readable description of agent capabilities
api_tokenstringYour Agentverse API key for registration
mailboxboolWhether to use Agentverse mailbox for persistence (optional)
ai_agent_addressstringAI Agent address to conver Natural language into structured query prompt (optional)

Communication Protocol

Once registered, adapter agents communicate using the uAgents chat protocol:

from uagents_core.contrib.protocols.chat import (
ChatMessage, TextContent
)

# Send a message to an adapter-wrapped agent
message = ChatMessage(
timestamp=datetime.utcnow(),
msg_id=uuid4(),
content=[TextContent(type="text", text="Your query here")]
)
await ctx.send(adapter_agent_address, message)

Cleanup and Management

Always clean up your agents when shutting down to ensure proper deregistration:

from uagents_adapter import cleanup_uagent

try:
# Your agent code here
while True:
time.sleep(1)
except KeyboardInterrupt:
# Clean up the agent
cleanup_uagent("your_agent_name")
print("Agent stopped.")

Next Steps

To explore concrete examples of adapter usage, refer to the uAgents Adapter Examples section.

4. MCP Server Adapter

The MCP Server Adapter lets you host your FastMCP servers directly on Agentverse or run locally with a mailbox, making them discoverable by ASI:One through the Chat Protocol.

First, create a FastMCP server implementation in a server.py file that exposes the required list_tools and call_tool async methods. Then, in the following agent.py, import the MCP server instance and use it with the MCPServerAdapter.

Agentverse-only (direct) deployment

from uagents import Agent
from uagents_adapter import MCPServerAdapter
from server import mcp

# Create an MCP adapter
mcp_adapter = MCPServerAdapter(
mcp_server=mcp,
asi1_api_key="your_asi1_api_key",
model="asi1-mini" # Model options: asi1-mini, asi1-extended, asi1-fast
)

# Create a direct uAgent for Agentverse
agent = Agent()

# Add the MCP adapter protocols to the agent
for protocol in mcp_adapter.protocols:
agent.include(protocol)

# Run the MCP adapter with the agent
mcp_adapter.run(agent)

See: Create MCP Server on Agentverse Example — how to deploy a FastMCP server as a uAgent using MCPServerAdapter.

Local agent with mailbox connection

Installation:

pip install "uagents-adapter[mcp]"
# Create a local uAgent with mailbox
agent = Agent(
name="alice",
port=8000,
seed="put_your_seed_phrase_here",
endpoint=["http://localhost:8000/submit"],
mailbox=True
)

Important: When creating MCP tools, include detailed docstrings using triple quotes (""") describing what each tool does, when it should be used, and what parameters it expects. These descriptions help ASI:One decide when and how to use your tools.

A2A Adapters (Inbound & Outbound)

The A2A adapters bridge Fetch.ai's uAgents with the wider Agent-to-Agent (A2A) protocol ecosystem, letting any Agentverse agent collaborate with A2A agents (and vice-versa) without code changes.

AdapterDirectionTypical Use-Case
Inbound A2A AdapterA2A → AgentverseExpose an existing Agentverse agent as a standard A2A endpoint so external A2A clients can discover & invoke it.
Outbound A2A AdapterAgentverse → A2ARegister one or more A2A agents as a single uAgent, so Agentverse workflows & ASI:One can leverage their capabilities.

Installation:

# Install A2A Inbound adapter
pip install "uagents-adapter[a2a-inbound]"

# Install A2A Outbound adapter
pip install "uagents-adapter[a2a-outbound]"

For full tutorials see:

Tip: Use adapters to compose best-in-class agents from any framework—no redesign required.