Intents
Intents are declarative transaction requests that abstract away low-level blockchain details. The system validates, builds, and executes intents through a multi-stage pipeline.Intent Structure
Every transaction begins as an intent:Supported Transaction Types
Agentic Wallet supports 26 transaction types:Native Transfers
transfer_sol
Transfer native SOL between accounts.
transfer_spl
Transfer SPL tokens.
DeFi Operations
swap
Token swaps via DEX aggregators.
stake / unstake
Staking operations (Marinade, etc).
lend_supply / lend_borrow
Lending protocol operations.
Token Management
create_mint
Create a new SPL token mint.
mint_token
Mint tokens to an account.
Escrow Operations
Escrow Transaction Types
Escrow Transaction Types
Create a new escrow with funds and conditions.
Accept an escrow as the counterparty.
Release funds to the beneficiary.
Refund funds to the creator.
Raise a dispute on an escrow.
Resolve a disputed escrow.
Create multi-milestone escrow.
Release a specific milestone.
Read-Only Operations
query_balance
Query wallet balance (no signature).
query_positions
Query DeFi positions (no signature).
Read-only intents (
query_*) skip signing and submission phases, confirming immediately after simulation.Advanced Operations
Advanced Intent Types
Advanced Intent Types
HTTP 402 payment protocol integration.
Flash loan transaction bundle.
Cross-Program Invocation.
Arbitrary instruction bundle.
Treasury budget allocation.
Rebalance between agent budgets.
Simulated trade for backtesting.
Intent Validation
Intents are validated through multiple layers:1. Schema Validation
Zod schemas enforce type safety:2. Protocol Compatibility
The protocol adapter registry validates that the protocol supports the intent type:3. Policy Evaluation
Policies can block or require approval for intents:4. Agent Capability Check
If executed by an agent, the intent must be in the allowlist:5. Budget Validation
Spend-capable intents check agent budgets:Legacy Adapter Behavior
Theintent-runner CLI provides backward compatibility:
- Wallet ID lookup:
fromWalletId(base58) → internal UUID - Metadata preservation:
chain,createdAt,reasoningstored inintent.legacy - Type normalization:
transfer→transfer_solortransfer_spl(based on mint presence)swap→swapcreate_mint→create_mintmint_token→mint_token
Legacy adapter behavior is documented in SKILLS.md:60 for orchestrator compatibility.
Idempotency
UseidempotencyKey to prevent duplicate transactions:
- First request: Creates new transaction
- Duplicate key: Returns existing transaction record
- Key scope: Per wallet
- Key length: 8-128 characters
Gasless Transactions
Setgasless: true to route through sponsored RPC:
- Protocol must have
gaslessEligible: truein risk config KORA_RPC_URLmust be configured- Transaction must meet size/complexity limits
Paper Trading
SetpaperOnly: true in intent to simulate without execution:
- Skip signing and submission
- Record to strategy store
- Useful for backtesting and validation
- No budget deduction
Best Practices
Intent Design
Intent Design
- Use specific intent types (not
custom_instruction_bundle) when possible - Include all required fields for protocol adapter
- Set reasonable slippage for swaps (50-200 bps typical)
- Use idempotency keys for user-facing operations
- Validate amounts before submission
Error Handling
Error Handling
- Check
statusandfailedAtin response - Handle
approval_gatestatus for manual approval flow - Retry on
PIPELINE_ERRORwith exponential backoff - Never retry on
POLICY_VIOLATIONorVALIDATION_ERROR - Monitor
errorCodefor categorization
Security
Security
- Validate destinations before transfers
- Use address allowlists for high-value operations
- Set spending limits via policies
- Audit flash_loan and cpi_call intents carefully
- Restrict custom_instruction_bundle to trusted agents
Source Code Reference
Intent handling is implemented in:packages/common/src/schemas/transaction.ts- Intent type definitions (packages/common/src/schemas/transaction.ts:14)services/transaction-engine/src/pipeline/*- Execution pipelineservices/protocol-adapters/src/index.ts- Protocol routing (services/protocol-adapters/src/index.ts:1)SKILLS.md- Canonical intent contract (SKILLS.md:312)