Quickstart

Send your first agent email

Get from zero to a working agent action in under 5 minutes. No SDK to install — your agent talks directly to the REST API.

Prerequisites

  • An AgentBlocks account — sign up free
  • An API key from the dashboard
  • An AI agent (Claude Code, a custom agent, etc.)
1

Configure rules in the dashboard

Before your agent can act, set up policy rules in the AgentBlocks dashboard. Rules are evaluated server-side — your agent can't modify them. For this example, the default rules work fine: all email sends require human approval.

2

Tell your agent about AgentBlocks

Just tell your agent in natural language. No SDK or install step — the agent uses the REST API directly.

Terminal
> Use the AgentBlocks API for email. The docs are at https://api.agentblocks.ai/agent-guide and your API key is in env as AGENTBLOCKS_API_KEY
3

Agent discovers its capabilities

The agent reads the guide, then calls GET /agent/info to discover what it can do.

Terminal
curl https://api.agentblocks.ai/agent/info \
-H 'Authorization: Bearer $AGENTBLOCKS_API_KEY' \
-H 'X-Agent-Version: 2026-02-23.02'
// → capabilities: ["email", "github", "gmail", "drive", "slack"]
// → defaultAddress: "[email protected]"
4

Agent sends an email

The agent calls POST /email/send-request with the email details. AgentBlocks evaluates it against your dashboard rules.

Terminal
curl -X POST https://api.agentblocks.ai/email/send-request \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer $AGENTBLOCKS_API_KEY' \
-H 'X-Agent-Version: 2026-02-23.02' \
-d '{"to": "[email protected]", "subject": "Following up", "body": "Hi Sarah, just wanted to follow up..."}'

If your rules require approval, the response returns type: "queued" with a token. If auto-approved, the email is sent immediately.

5

Approve and watch it send

You'll receive a notification (via Slack, email, or WhatsApp — depending on your agent config) with the email details. Approve it, and AgentBlocks sends the email on your agent's behalf.

If the action required approval, the agent polls GET /operations/:token until the status becomes approved, rejected, or timed_out.

Action approved and executed

Email sent to [email protected] from [email protected]