Agent Identity
← BLOG

How an AI agent signs itself up for its own email address

· Markdown

No form, no card, no pre-existing account. An agent registers, a human reads one 6-digit code, and the agent has a real inbox and an API key. Step by step, with the SDK or plain HTTP.

Most services assume a human is filling in the signup form. An agent cannot do that, and it should not have to borrow a person's login. Agent Identity lets the agent register itself. The only thing a human does is read a 6-digit code out of their inbox, which proves a real person stands behind the agent.

What you end up with

  • An organization that belongs to the agent and its owner.
  • An identity: a handle and a deliverable email address.
  • An API key scoped to that one identity, not the whole organization.
  • A durable event log the agent can wait on, so it does not have to poll for replies.

Step 1: install the SDK

npm install @agentidentity/sdk

Step 2: register and verify

Registration is unauthenticated. The response carries an admin API key that is shown exactly once, so store it straight away. Naming an owner emails them a 6-digit code.

import { createOrganization, verifyOwner } from "@agentidentity/sdk";

const BASE = "https://api.agent-identity.dev";

const org = await createOrganization(BASE, {
  name: "My Agent",
  slug: "my-agent-123",          // unique across the service
  ownerEmail: "human@example.com",
});

// org.adminApiKey is returned once. Store it now.
await verifyOwner(BASE, org.adminApiKey, "<the 6-digit code the human read out>");

Until the code is entered, the organization can only email its owner, a few messages a day. After that it can email anyone. The code expires in 15 minutes and allows five wrong guesses.

Step 3: give the agent an identity and send mail

import { AgentClient } from "@agentidentity/sdk";

const admin = new AgentClient({ baseUrl: BASE, apiKey: org.adminApiKey });
const me = await admin.identities.create({ handle: "support", displayName: "Support Agent" });

// A key that acts as this agent only.
const key = await admin.apiKeys.create({ name: "self", identityId: me.id });
const self = new AgentClient({ baseUrl: BASE, apiKey: key.key });

await self.mail.send({
  identityId: me.id,
  to: ["human@example.com"],
  subject: "Hello from my own inbox",
  text: "This message was sent by an agent with its own address.",
});

Prefer a prompt?

Give your coding agent this: Read https://www.agent-identity.dev/llms.txt, then follow https://www.agent-identity.dev/docs/getting-started/agent-signup.md to register yourself with Agent Identity using @agentidentity/sdk. Ask me for the owner's email, then ask me for the 6-digit code. Store the key in AID_API_KEY, create an identity and send me a test email.

Read more

  • Agent signup: https://www.agent-identity.dev/docs/getting-started/agent-signup
  • Quickstart: https://www.agent-identity.dev/docs/getting-started/quickstart
  • Authentication and API keys: https://www.agent-identity.dev/docs/getting-started/authentication

Give your agent its own inbox in a couple of minutes. Get started → · Docs · llms.txt