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

Bring offchain answers into your contract.

Somnia Agents let smart contracts query public APIs, run deterministic AI models and parse websites. A subcommittee of validators runs each request, agrees on the result and returns it to the contract with signed execution receipts.

Read the docs
Request 48213LLM Parse WebsiteRunning
QuestionHas the venue published its 2026 annual report?
  1. RequestcreateRequest()payload + deposit
  2. ElectSomniaAgentselects 3 validators
  3. ExecuteValidator 1 · 2 · 3sandbox · receipt
  4. AgreeConsensusmajority or threshold
  5. DeliverhandleResponse()result + receipts
  6. Pay per requestfees set per agent and per validator
ValidatorResultReceiptStatus
0x8f3a…21c4true0x5d07…a9e1Running
0x2b91…7e05true0x91c4…03bdRunning
0xc604…9a38true0x3e6f…d572Running
Validators you can set per advanced request
Up to 10
Validators you can set per advanced request
Validators in the default subcommittee per request
3
Validators in the default subcommittee per request
Somnia Agents docs
Consensus types per request: majority and threshold
2
Consensus types per request: majority and threshold
Somnia docs, Invoking from Solidity
Fee the platform contract takes; unused deposit is rebated
0%
Fee the platform contract takes; unused deposit is rebated

Answers your contract can check.

  • Remove the trusted middleman

    A subcommittee of validators runs each request and must agree on the result, so no single server decides what your contract receives.

  • Keep a receipt for every result

    Every response comes with a signed execution receipt you can use in an audit or a dispute.

  • Bring AI into contract logic

    Run deterministic language models from a contract and act on the agreed answer.

Pick the agent for the job.

  • JSON API Request

    Fetch a string, number, flag or array from any public JSON endpoint with a selector path.

    • fetchUint(url, selector, decimals)
    • Priced per request in SOMI; see the docs for current prices
  • LLM Inference

    Run deterministic language models from a contract, including MCP and onchain tool calls.

    • 4 output modes
    • Priced per request in SOMI; see the docs for current prices
    LLM Inference
  • LLM Parse Website

    Read a web page and return a structured answer to a question about it.

    • Question in, structured answer out
    • Priced per request in SOMI; see the docs for current prices

Automate decisions you can audit.

Resolve outcomes without a resolution desk

Somnia Agents structure, create and resolve every market on Prophecy Social without manual intervention, and run the agent committees behind Somnia Oracle.

33.1K

Prophecy Social

33.1K users as of 1 Sep 2026

Read the story
Resolution requestIllustrative
Question
Has the venue published its 2026 annual report?
Agent
LLM Parse Website
Sources
2 public web pages
Subcommittee
5 validators
Consensus
Threshold, 3 of 5
Result
Agreed answer with receipts
Receipts
5, one per validator

How an agent request runs.

AgentConsumer.solsolidity
// Adapted from docs.somnia.network/agents/invoking-agents/from-solidity
IAgentRequester public platform =
IAgentRequester(0x5E5205CF39E766118C01636bED000A54D93163E6); // mainnet
function request(string calldata url, string calldata path)
external payable returns (uint256 requestId)
{
bytes memory payload = abi.encodeWithSelector(
IJsonApiAgent.fetchUint.selector, url, path, uint8(8)
);
uint256 deposit = platform.getRequestDeposit()
+ JSON_FETCH_COST_PER_AGENT * SUBCOMMITTEE_SIZE;
requestId = platform.createRequest{value: deposit}(
JSON_API_AGENT_ID, address(this),
this.handleResponse.selector, payload
);
}
function handleResponse(uint256 requestId, Response[] memory responses,
ResponseStatus status, Request memory) external {
require(msg.sender == address(platform), "Only platform");
if (status == ResponseStatus.Success && responses.length > 0)
value = abi.decode(responses[0].result, (uint256));
}
handleResponse()Illustrative callback
requestId
48213
subcommittee
3 validators
status
2 · Success
responses
3 of 3 submitted
consensus
Majority
result
abi-encoded uint256
receipt
0x5d07…a9e1, per validator
rebate
Unused deposit returned
Before you go to mainnetFrom the docs
  • Check that msg.sender is the platform contract.
  • Track pending request IDs.
  • Handle Failed and TimedOut as well as Success.
  • Add receive() so rebates can reach your contract.
  • Send getRequestDeposit() plus the agent price times the subcommittee size.

AgentConsumer.sol, adapted from the Somnia Agents docs

Try it in the browser, ship it in a contract.

Try an agent in the browser

Browse agents, invoke methods, inspect receipts and generate Solidity or TypeScript code from the Agent Explorer.

Open Agent Explorer

Call an agent from your code

From Solidity, call createRequest() or createAdvancedRequest() and receive the result in a callback. From TypeScript, send the transaction and listen for the response event.

  • Mainnet chain ID 5031
  • Platform contract 0x5E5205CF39E766118C01636bED000A54D93163E6
Invoke from Solidity

Set the rules for every request.

  • Set how much agreement each answer needs

    Choose subcommittee size, threshold and consensus type for each request.

  • Keep proof of what each validator ran

    Each validator that runs the request signs its own receipt.

  • Pay only for what a request uses

    You pay per agent and per validator, and any unused deposit comes back to you.

  • Put a deadline on advanced requests

    Advanced requests set their own deadline, after which the request closes as timed out.

  • Know how every request ended

    Every request ends as Success, Failed or TimedOut, and your callback hears which.

  • Skip writing the call by hand

    The Agent Explorer writes the Solidity or TypeScript call for any agent method.

Put an agent behind your contract.

Try an agent in the browser, or talk to the team about what your contract needs to know.

Read: Somnia, the Agentic L1