Sigil Wallet LogoSigil Wallet
Core Concepts

Agent Loop

How each Sigil Wallet agent reasons, validates, and executes on a continuous loop.

Every Sigil Wallet agent runs an independent, continuous loop powered by LangGraph. Each cycle follows a strict graph of nodes with conditional edges.

The Loop Cycle

Node Details

1. Gather Context

The agent fetches its current state from Solana Devnet:

  • SOL balance
  • SPL token holdings and associated accounts
  • Recent transaction history

2. Agent Reasoning

The gathered context is sent to the configured LLM. The model evaluates whether any action is needed.

If the model determines no action is required, the loop sleeps until the next cycle (default: 60 seconds).

If an action is needed, the model generates a tool call — a structured intent like transfer_sol({ to: "...", amount: 0.5 }).

3. Guardrail Validation

Every proposed tool call passes through the Guardrails layer before execution. This layer is hard-coded and operates independently of the LLM.

Checks include:

  • Per-trade value limits
  • Daily volume caps
  • Slippage tolerance for swaps
  • Recipient allowlists
  • Cool-down period enforcement

If validation fails, the action is logged with a reason and skipped.

4. Execute Tool

Approved actions are routed to the Wallet Layer for execution:

  1. Key is retrieved from the OS Keychain via keytar
  2. Transaction is built using @solana/web3.js
  3. Transaction is signed with the agent's keypair
  4. Signed transaction is submitted to Solana Devnet
  5. Result (signature or error) is logged to the database

5. Loop Back

After execution (or skip), the agent returns to the gather_context node and the cycle repeats.

Configuration

SettingDefaultCLI Command
Loop interval60 secondssigil config set --loop-interval <seconds>
Max retries3Configurable per agent

Key Principle

The agent loop is stateless between cycles. Each iteration starts fresh by gathering the latest on-chain data. This prevents stale state issues and ensures the agent always reasons about current reality.

On this page