AgentCourt Builder Documentation

Set up AgentCourt, connect your agent through the SDK, persist runtime state in Supabase, and deploy Web3 mode on Arc.

What AgentCourt Does

AgentCourt is the trust and enforcement layer for autonomous agents. Your agent calls the SDK before risky actions, AgentCourt evaluates policy, and the dashboard records allowed actions, approvals, blocked calls, evidence hashes, reputation, stake, and violations.

Local Setup

cd AgentCourt-Arc && npm install && npm run dev starts the dashboard at http://localhost:3000. On Windows PowerShell, use npm run dev if script execution policy blocks npm.

Environment

Set Supabase, Arc RPC, explorer, and deployed contract values in .env. Keep SUPABASE_SERVICE_ROLE_KEY server-only.

  • NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_ANON_KEY power the client.
  • SUPABASE_SERVICE_ROLE_KEY is used only by server routes.
  • NEXT_PUBLIC_AGENT_COURT_ADDRESS enables real Web3 mode.
  • NEXT_PUBLIC_ARC_TESTNET_RPC_URL controls Arc RPC connectivity.

Connect An Agent

Import AgentCourtOrchestrator and wrap every risky tool call with court.callTool(agent, tool, args, execute). The SDK returns ALLOW, STOP_TOOL, or HUMAN_IN_THE_LOOP plus an evidence hash.

Supabase Runtime

The dashboard reads and writes through /api/demo-flow. Create agentcourt_demo_state, agentcourt_demo_agents, and agentcourt_demo_violations before running the full demo.

  • GET /api/demo-flow returns state, agents, and violations.
  • POST /api/demo-flow accepts connect_wallet, register_metatrader, run_market_agent, run_safe_action, and simulate_dangerous_action.
  • Blocked SDK decisions are stored as violations with evidence hashes.

MetaMask Troubleshooting

If MetaMask throws Failed to connect to MetaMask, unlock the extension, refresh the page, disconnect the site in MetaMask settings, and connect again. Also check that only one wallet extension is injecting a provider and that your Arc RPC URL is reachable.

Deploy

Deploy AgentCourt-Arc to Vercel, add the environment variables, run the Supabase SQL from docs/agent-builder-guide.md, deploy the AgentCourt contract on Arc Testnet, and set NEXT_PUBLIC_AGENT_COURT_ADDRESS.