← Protocols
Fetch.ai (uAgents)
AI Agent / Web3·Cosmos · Multi-chain

Fetch.ai (uAgents)

01Description

Decentralized agent network with the uAgents Python framework. Each agent registers on the Almanac smart contract on Fetch.ai's chain, holds a wallet, and discovers/communicates with peers using cryptographically signed messages. Powers the ASI Alliance agent economy.

02Best for
  • 01agent-to-agent messaging
  • 02decentralized agent discovery (Almanac)
  • 03scheduled/periodic agents
  • 04agent micropayments in FET
  • 05Innovation Lab marketplace agents
03Install
  • pip install uagents
  • pip install uagents-core
04Environment variables
VariableScopeDescription
AGENT_SEEDServerDeterministic seed phrase used to derive the agent's identity and wallet. Server-only.
AGENTVERSE_API_KEYServerOptional — needed to publish to Agentverse / Innovation Lab and hit hosted services.
ASI1_API_KEYServerOptional — Fetch.ai's ASI-1 LLM API for agents that use the native model.
05Prompt snippet
Use the uAgents framework to build decentralized agents. `agent = Agent(name='alice', seed=os.environ['AGENT_SEED'], port=8000, endpoint=['http://localhost:8000/submit'])` registers on the Almanac on first run. Define behaviour with decorators: `@agent.on_interval(period=30.0)` for cron-style work, `@agent.on_message(model=MyModel)` for typed inbound messages, and `await ctx.send(other_address, MyModel(...))` to message peers. All messages are Pydantic-typed and cryptographically signed by the agent's wallet. Publish to Agentverse with the `mailbox` integration so the agent is reachable without exposing a public endpoint, and use `ctx.ledger` plus `ctx.wallet` for FET-denominated micropayments between agents.
06Gotchas
  • Almanac registration costs FET — a fresh agent with an empty wallet cannot register itself; pre-fund the address from the seed.
  • If two processes share the same `AGENT_SEED`, both register the same identity and message routing becomes nondeterministic.
  • Agents behind NAT must use the Agentverse mailbox — direct `endpoint=['http://...']` only works on publicly reachable hosts.
  • Almanac entries expire; long-idle agents must re-register or peers will fail to discover them.
  • Message models must be identical (field names + types) on sender and receiver — a mismatched Pydantic class drops messages silently.
  • When integrating an LLM, cap tool/iteration counts and rate-limit `ctx.send` calls — agents can spam peers and burn FET.
07Alternatives