Skip to content
AnnouncementSomnia Oracle settles event contracts onchain, in minutes, with receipts.

Agents inside consensus: how Somnia Agents work

Somnia Agents let smart contracts call APIs, read websites and run deterministic AI models, with results agreed by a validator subcommittee and every step receipted.

· 6 min readAI agentsOracles & dataInfrastructure

Smart contracts are good at enforcing rules over data they already have and poor at fetching anything new. Every time an application needs a price, a sports result, a web page or a model's judgement, it usually relies on outside infrastructure: an oracle network for one data type, a different service for another, a centralised API for AI. Each adds a counterparty and an integration to maintain.

Somnia Agents bring that work inside the network. A contract or user invokes an agent, a subset of Somnia validators runs it, and the network agrees on the result before it reaches the contract.

Execution by subcommittee

When an agent is invoked, it runs on a subcommittee of Somnia nodes, three by default. Each node:

  • Executes the agent independently in a sandboxed container.
  • Produces its own execution receipt.
  • Submits an ABI-encoded result onchain.

The network then reaches consensus on the result, by majority or by a configurable threshold of matching responses. The caller's callback receives a valid result only when enough nodes agree; otherwise the request is rejected.

Receipts are kept either way. A receipt is a signed manifest of the intermediate steps one node took, much like a CI build log. Validators agree on the final result, not on each step, but anyone can inspect every node's receipt afterwards, including for requests that failed.

Deterministic AI

Running a language model across several nodes only works if they produce the same output. Somnia's LLM agents use fixed random seeds and controlled temperature, so the same input always gives the same output on every validating node (Somnia documentation). That determinism lets independent nodes verify each other's AI output, the same way they verify any other computation.

The base agents

  • JSON API Request: fetches a URL and extracts a value by path, returned as a typed result such as a uint256 price. 0.03 SOMI per agent.
  • LLM Inference: runs a deterministic model on a prompt and returns structured output. It supports tool calls, including MCP and onchain tools. 0.07 SOMI per agent.
  • LLM Parse Website: opens a page in a browser session, renders it and extracts the requested information with a model. 0.10 SOMI per agent.

These are the current per-agent runner prices from the Somnia Agents gas documentation. A request deposits enough to cover a small operations reserve plus the per-agent price times the subcommittee size. With the default three agents, a JSON API request costs 0.12 SOMI in total, and anything unspent is rebated.

EVM-native by design

Agents use the standard Solidity ABI for both input and output. Developers call them with the tools they already use, such as viem, ethers.js or Solidity's own encoders. An agent behaves like a contract that can reach the internet.

Where agents are used today

Somnia Agents are live on mainnet and testnet. The documentation labels them a prototype, and the interfaces may still change. Their most visible use is the Somnia Oracle: agent subcommittees read the sources for each question, and the oracle aggregates their answers onchain. That is how Prophecy Social markets and dreamDEX event contracts settle. Agents can also act as general-purpose oracles, trigger outbound calls to external services, or supply judgement inside autonomous strategies.

The agents pages of Somnia Explorer show requests, results and receipts as they happen.

Why it matters for markets

Markets run on information. When the facts a market settles on are fetched, agreed and receipted by the network, there is no oracle operator between the market and the truth. The audit trail sits in the same place as the trade, and anyone can check both.

Build your market on Somnia

Talk to our team about launching a venue, making markets, or bringing an asset onchain. Or start building today with the docs.