MonmouthMonmouth Docs

Intent Resolution

What is Intent Resolution?

Instead of constructing raw transactions, agents express intents — what they want to accomplish. Monmouth resolves these intents to optimal execution paths.

// Traditional: Construct raw transaction
const tx = {
  to: '0x...',
  data: '0x...',
  value: parseEther('1'),
  gasLimit: 200000,
}
 
// Monmouth: Express intent
const intent = {
  type: 'swap',
  fromToken: 'ETH',
  toToken: 'USDC',
  amount: '1 ETH',
}

Why Intents?

  1. Simplicity: Agents don't need to know contract ABIs or construct calldata
  2. Optimization: Monmouth finds the best execution path (DEX routing, gas optimization)
  3. Safety: Intents are validated against guardrails before execution
  4. Classification: Every intent is automatically classified and scored

Intent Types

Swap

{
  type: 'swap',
  fromToken: 'ETH',
  toToken: 'USDC',
  amount: '1 ETH',
  maxSlippage: '0.5%',
  preferredRouters: ['uniswap', 'sushiswap'], // optional
}

Transfer

{
  type: 'transfer',
  token: 'ETH',
  amount: '0.5 ETH',
  to: '0x...',
  memo: 'Payment for services', // optional
}

Lending

{
  type: 'lend',
  protocol: 'aave',
  action: 'deposit', // or 'borrow', 'repay', 'withdraw'
  token: 'USDC',
  amount: '1000 USDC',
}

Cross-Chain

{
  type: 'cross-chain',
  targetChain: 'solana',
  intent: {
    type: 'swap',
    fromToken: 'SOL',
    toToken: 'USDC',
    amount: '10 SOL',
  }
}

Resolution Process

  1. Parsing: Intent Parser validates and normalizes the intent
  2. Classification: Transaction Classification identifies the operation type
  3. Validation: Check against agent guardrails, policies, and capability validations
  4. Routing: Find optimal execution path
  5. Simulation: Dry-run to estimate gas and outcomes
  6. Execution: Submit transaction(s)
  7. Settlement: Confirm and update reputation

Confidence Scoring

Each resolution includes a confidence score:

const result = await wallet.resolveIntent(intent)
 
console.log(result)
// {
//   confidence: 0.95,
//   estimatedGas: 180000,
//   estimatedOutput: '1842.50 USDC',
//   route: ['WETH', 'USDC'],
//   protocol: 'uniswap-v3',
// }

Configure minimum confidence thresholds:

const wallet = new MonmouthWallet({
  intentResolution: {
    minConfidence: 0.9, // Reject below 90% confidence
    preferredProtocols: ['uniswap', 'aave'],
    maxHops: 3, // Maximum routing hops
  }
})

On this page