Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Advisory Decisions

Agents can write spells that include AI-powered decision points using advise blocks. This is how you embed judgment into a strategy while keeping it auditable.

SmartRebalance Example

spell SmartRebalance {
  advisors: {
    risk: { model: "anthropic:haiku" }
  }

  venues: {
    aave: @aave_v3
    morpho: @morpho_blue
  }

  params: {
    amount: 50000
  }

  on manual: {
    decision = advise risk: "Given current gas costs and rate differential, should we rebalance?" {
      output: { type: boolean }
      timeout: 10
      fallback: false
    }

    if decision {
      aave.withdraw(USDC, params.amount)
      morpho.lend(USDC, params.amount)
    }
  }
}

Advisory decisions have a typed schema, a timeout, and a fallback — so the spell always has a deterministic path even if the model is unavailable.

Deterministic Replay

For deterministic replay of advisory decisions:

Record
# Record decisions during simulation
grimoire simulate spells/smart-rebalance.spell --chain 1