All Agent Setups
Builder-friendly onchain agentLow complexityDevelopers

Coinbase AgentKit + RiskState + Agentic Wallet

Fastest path to a risk-governed agent. AgentKit handles wallet creation, transaction signing, and onchain actions. Alchemy provides onchain data, token balances, and transaction history. RiskState adds the missing governance layer.

How it works

1

Alchemy provides market intelligence

Your agent queries Alchemy for real-time market data — onchain data, token balances, and transaction history. No API key required, unlimited calls.

2

RiskState gates the decision

Before any execution, your agent calls POST /v1/risk-state. The response contains max_size_fraction (position ceiling), allowed_actions (what’s permitted), and structural_blockers (hard stops). If blockers exist, the agent halts. Otherwise, it sizes the trade within the policy limit. 30+ signals scored in real-time, 60-second cache, SHA-256 audit hash.

3

AgentKit Actions executes within limits

The trade is submitted to AgentKit Actions using built-in wallet actions. Transaction signing handled by the Agentic Wallet — no private key management. Position size never exceeds what RiskState permitted.

Integration code

Copy this into your project. Replace the API keys with your own.

agentkit_riskstate.ts
import { AgentKit } from "@coinbase/agentkit";

// 1. Initialize AgentKit (wallet + onchain actions)
const agentKit = await AgentKit.from({
  cdpApiKeyName: CDP_KEY_NAME,
  cdpApiKeyPrivateKey: CDP_PRIVATE_KEY,
});

// 2. Get risk policy from RiskState
const policy = await fetch(
  "https://riskstate.netlify.app/v1/risk-state",
  {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${RISKSTATE_KEY}`,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({ asset: "ETH" })
  }
).then(r => r.json());

const { max_size_fraction, allowed_actions, blocked_actions }
  = policy.exposure_policy;

// 3. Enforce governance
if (blocked_actions.includes("ALL_IN")) {
  console.log("Full allocation blocked by policy");
}

// 4. Execute within limits using AgentKit Actions
const balance = await agentKit.getBalance("ETH");
const maxDeploy = balance * max_size_fraction;
console.log(`Policy allows deploying up to ${maxDeploy} ETH`);
// agentKit.trade(), agentKit.swap(), etc.

What your agent receives from RiskState

Every call to /v1/risk-state returns these three blocks. Your agent reads them in order.

Exposure Policy

Binding
  • max_size_fraction — hard ceiling
  • leverage_allowed — boolean
  • allowed_actions — enum list
  • blocked_actions — enum list

Market Intelligence

Context
  • tactical_state — LEAN BULL, etc.
  • market_regime — TREND, RANGE...
  • binding_constraint — source + why
  • risk_flags — blockers + risks

Auditability

Trust
  • policy_hash — SHA-256
  • confidence_score — 0-100
  • data_sources — per-signal
  • ttl_seconds — cache hint

Start building

Get an API key in under a minute. Free during beta.