Somnia Agents

Somnia Agents

Decentralized, auditable compute jobs, including LLM tasks, that smart contracts and users can invoke on Somnia.

Prototype notice. Somnia Agents is in prototype state and deployed on both Somnia Mainnet (chain ID 5031) and Somnia Testnet (chain ID 50312). Features and APIs may change as development progresses. See the Quickstart for current contract addresses and RPC URLs.

Vision

Smart contracts revolutionized trustless computation, but they operate in isolation. They cannot fetch external data, call APIs, or perform complex computation. Today's solutions require stitching together multiple systems (Chainlink for price feeds, separate oracle networks for weather data, centralized services for AI), each adding counterparty risk and integration complexity.

What if smart contracts could natively access the internet, run AI models, and perform arbitrary computation, all while keeping the blockchain guarantees of decentralization and auditability?

Somnia Agents extend the Somnia blockchain by letting smart contracts and users trigger decentralized, auditable compute jobs, including LLM-based tasks, executed across Somnia's decentralized network. By integrating with Somnia's native on-chain reactivity, agents make it possible to build and run fully featured decentralized applications.

What are Somnia Agents?

Somnia Agents are decentralized, sandboxed compute containers. This makes them as simple to develop as familiar serverless platforms such as AWS Lambda or Google Cloud Run, with the added blockchain properties of auditability, reactivity and security.

Capabilities

Somnia Agents unlock use cases that traditional EVM smart contracts can't support:

  • Acting as oracles: query the internet and reliably bring external data on-chain. See JSON API Request and Price Oracle.
  • Outbound communication: trigger actions or send messages to external internet services.
  • LLM invocation: use on-chain deterministic AI models for autonomous agents. See LLM Inference and LLM Parse Website.

How Somnia Agents work

  1. A user or smart contract invokes an agent.
  2. The request goes to a subcommittee: a decentralized subset of Somnia network nodes (Node 1, Node 2, Node 3 … Node N).
  3. Each node submits an ABI-encoded result (with a success flag) on-chain, and uploads an execution receipt as an audit trail. Receipts are always produced.
  4. On-chain consensus checks whether a majority, or a configured threshold, of nodes agree on the result.
  5. If they agree, the valid result is delivered to the caller's callback. If not, the request is rejected.

Execution

When an agent is invoked, it runs on a subcommittee. Each node independently executes the agent, produces its own execution receipt, and submits an ABI-encoded result (with a success flag) on-chain. These are always produced, regardless of the outcome.

The network then reaches consensus on the result on-chain, by majority or by a configurable threshold of matching responses. A result is delivered to the caller's callback as valid only when enough nodes agree; otherwise the request is rejected. Either way, every node's audit receipt remains available, so anyone can inspect each step of an agent execution after the fact, including failed or rejected ones.

Deterministic LLMs

Somnia Agents can invoke large language models (LLMs) that run as part of the validator network. Unlike traditional LLM APIs, where outputs vary between calls, Somnia's LLMs use fixed random seeds and controlled temperature parameters to produce deterministic outputs: the same input always yields the same output across all validating nodes.

This determinism enables consensus. When multiple nodes independently run the same LLM inference with identical parameters, they produce identical results, so the network can verify and agree on AI-generated outputs.

See LLM Inference for usage details.

Receipts

An execution receipt is a signed manifest of the intermediate computation steps taken within the agent, similar to the logs and manifests produced by CI build systems. A typical receipt records:

  1. Input received
  2. Processing
  3. External call
  4. Result computed
  5. Output encoded

The receipt is signed by the validator and forms the on-chain audit trail.

Important. The final result is what validators reach consensus on. Receipt steps are subjective: they show what one node did to compute the result, which may vary slightly between nodes. This gives transparency without requiring consensus on every intermediate step.

See Receipts for viewing and understanding receipts.

Payment and gas

Invoking an agent requires SOMI (mainnet) or STT (testnet). You send a deposit when creating a request. The contract splits it into two pots:

  • an operations reserve (minPerAgentDeposit × subcommitteeSize) that funds runner gas refunds, callback gas and keeper payments;
  • an agent reward pot (everything above the reserve), split equally and paid to every elected subcommittee member at finalisation.

Whatever is left after everything settles is rebated to the requester.

See Gas fees for the full fund flow and how to size deposits.

EVM-native schema

Somnia Agents are invoked via HTTP POST requests, where both the input data and the returned result are ABI-encoded, just like Ethereum smart contract calls.

The interface and schema of each agent closely follow the standard Solidity contract ABI. You can use familiar web3 tools, such as viem, Ethers.js or Solidity's own ABI encoders and decoders, to interact with agents exactly as you would with a smart contract.

Key benefits:

  • Code reuse with existing smart contract tooling
  • Seamless integration with developer workflows
  • Agents feel like native blockchain contracts
  • Richer off-chain compute and connectivity

Roadmap

Agents roll out in phases:

Phase When Scope
Phase 1 (current) Now Core agents available: JSON API Selector, Idempotent Request, AI LLM Invocation, AI Parse Website, Find URL for Topic
Phase 2 2026 Custom user-defined agents, full Agent SDK, advanced tooling

Phase 1 (current): a curated set of core agents is available to the ecosystem, covering common use cases like oracles, AI and external communication.

Phase 2 (2026): support for fully custom, user-defined agents will launch, further expanding Somnia's capabilities.

Use cases

Oracles

Build on-chain oracles with the JSON API Request agent:

  • Price feeds from cryptocurrency APIs
  • Weather data for parametric insurance
  • Sports scores for prediction markets
  • Any external API data

AI services

Use deterministic AI with LLM Inference and LLM Parse Website:

  • Text generation and analysis
  • Content moderation decisions
  • Dynamic NFT descriptions
  • Intelligent automation

Outbound communication

  • Webhook triggers from smart contracts
  • Notifications to external systems
  • Off-chain workflow initiation
  • Database synchronization

Data processing

  • JSON extraction and transformation
  • Web scraping with AI (see LLM Parse Website)
  • Data validation and enrichment
  • Format conversion

Key features

  • EVM-native: standard Solidity ABI encoding for seamless integration.
  • Decentralized: no central authority or single point of failure.
  • Auditable: every execution produces verifiable receipts.
  • Monetizable: agent runners earn fees from usage.
  • Composable: agents can be chained together.
  • Permissionless: anyone can invoke agents.
  • Deterministic AI: on-chain AI with consensus guarantees.

Next steps

Invoking agents

Base agents

Explorer

Edit this page