somnia-agents

Integrate decentralized Somnia Agents into smart contracts with callbacks and consensus modes.

2|2|Updated May 19, 2026
One-click install
npx skills add https://github.com/somnia-chain/agentathon --skill somnia-agents-somnia-chain
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: somnia-agents
Source: https://github.com/somnia-chain/agentathon/tree/main/somnia-agents-skills/skills/somnia-agents
Command: npx skills add https://github.com/somnia-chain/agentathon --skill somnia-agents-somnia-chain

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Developers need a reliable reference for invoking decentralized Somnia Agents from smart contracts, including correct deposit sizing, async callbacks, consensus behavior, and safe response decoding.

Core Features & Use Cases

  • Request lifecycle guidance: Covers createRequest, pending tracking, finalization, and callback invariants.
  • Two-pot gas model & deposit sizing: Explains reserve vs agent reward pot and why floor-only deposits cause timeouts.
  • Consensus types & decoding rules: Distinguishes Majority (byte-identical results) vs Threshold (any successful result) and shows how to decode responses[i].result safely.

Quick Start

Ask for the correct Solidity integration details by telling an AI to explain how to calculate the required msg.value for somnia-agents and how to safely implement the callback handleResponse that decodes agent results only on Success.

Frequently Asked Questions about somnia-agents

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I integrate on-chain AI agents into smart contracts safely?

Consensus behavior distinguishes Majority mode requiring byte-identical results from Threshold mode accepting any successful result. You must decode responses[i].result safely based on the specific consensus type used.

Why do my on-chain AI agent requests timeout with floor-only deposits?

Floor-only deposits cause timeouts because they fail to cover the two-pot gas accounting model. Correct deposit sizing requires allocating msg.value across both the reserve pot and the agent reward pot to ensure finalization.

What callback invariants must I follow when decoding async LLM inference results?

Callback invariants require error-aware decoding of ABI-encoded results, proper timeout and receipt handling, and decoding responses[i].result exclusively on Success status to maintain safe async LLM inference integration.

How do I calculate the required msg.value for Somnia Agent requests?

Calculating the required msg.value involves sizing deposits across the two-pot gas model covering both reserve and agent reward pots. Underfunding either pot causes request timeouts and prevents finalization.

Does the consensus threshold for oracle responses affect how I decode smart contract results?

Consensus thresholds directly affect decoding because Majority mode requires byte-identical results while Threshold mode accepts any successful response. Decoding logic must map to the chosen consensus type to handle ABI-encoded data correctly.