# Start here — bootstrap AgentDB from your agent runtime

Pick your runtime, pair, and persist a first entity. The whole contract is JSON-LD over one endpoint; no human API work required.

> HTML version: https://staging.agentdb.com/start — this file (/docs/start.md) is its markdown twin.

## The workflow

Onboarding is a hand-off between a human (once) and an agent (forever
after). Six named stages — every page on this site refers to them by name:

| Stage                                       | Who              | What happens                                                                                                                                                                                            | You now hold                                                                             |
| ------------------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| [Sign in](#sign-in)                         | You              | Request a one-time passcode by email and verify it (`LoginAction`, two requests — the second carrying the code from your inbox). Your first login creates your account and a **Person** principal.      | **Your JWT** — decode `principal_id` (your Person / acting org) before Create your agent |
| [Create your agent](#create-your-agent)     | You              | Create an **Agent organization** (`CreateAction` + `Organization` with `additionalType: "Agent"`) — one per agent you run. Its result carries a **one-time pairing token**; it is never returned again. | **The agent's one-time pairing token** (handed over at the next stage)                   |
| [Hand off the token](#hand-off-the-token)   | You              | Give your agent two things: the **base URL** and the **pairing token**. That is the entire hand-off — no API keys in agent code.                                                                        | Nothing new — your agent now holds the base URL + pairing token                          |
| [Your agent signs in](#your-agent-signs-in) | Your agent       | Exchanges the pairing token for session tokens. Single-use: a second attempt fails.                                                                                                                     | **The agent's JWT** + a refresh token — everything the next stage needs                  |
| [Your agent works](#your-agent-works)       | Your agent       | Entity CRUD, semantic `SearchAction`, and `AssessAction` analytics on the data plane with its JWT — and it rotates its own tokens, so no human is in the loop again.                                    | A growing tenant of entities + a fresh JWT on every rotation                             |
| [Scale to a fleet](#scale-to-a-fleet)       | You + your agent | More agents, same grammar: team roots, `Project` roots (workspaces), and services on the **data plane** — not admin `additionalType: "Workspace"` / `"Team"`.                                           | Shared `Project` roots any member agent can read and write                               |

Each stage is one JSON-LD payload (Hand off the token is the exception —
no API call):

### Sign in

Sign-in is passwordless: no signup form, no password to invent. It takes
**two requests**, because the server will not issue a session until you
prove you own the email address — nobody can sign in with someone else's
inbox. Your first login creates your account and a **Person** principal
(the console lands you on Billing with that principal selected). Create a
company `Organization` in the console when you need one for agents and
billing.

**Request 1 — ask for a code.** A `LoginAction` whose **object is you** —
a `Person` with just your email. POST it to the admin plane with no auth
header; the server emails you a six-digit passcode (it expires in ten
minutes).

#### Request 1 payload: `LoginAction` on a `Person` with your email

```jsonld
{
  "@context": "https://schema.org/",
  "@type": "LoginAction",
  "object": { "@type": "Person", "email": "you@example.com" }
}
```

**Request 2 — prove the inbox is yours.** Send the **same payload again**
with an `instrument` carrying the emailed code. The result's
`result.text` is your JWT (`is_new_user: true` if this login created your
account).

#### Request 2 payload: the same, plus the emailed `code` instrument

```jsonld
{
  "@context": "https://schema.org/",
  "@type": "LoginAction",
  "object": { "@type": "Person", "email": "you@example.com" },
  "instrument": [
    {
      "@type": "PropertyValue",
      "name": "code",
      "value": "<verification code>"
    }
  ]
}
```

That JWT is more than a credential: decode its payload (a JWT is three
base64 segments; the middle one is JSON) and the `principal_id` claim is
your acting principal's `@id` (Person after first login, or the company
Organization you selected in the console) — the value
[Create your agent](/start#create-your-agent) needs as `parentOrganization`.

More on this flow (rate limits, response shapes):
[email + one-time passcode](/integrations/email). A username + password
account also exists (`RegisterAction` on a `Person`, the same
request-then-code shape with the password as an extra instrument) — the
passwordless path above is the fastest way in.

You will meet the request-then-prove shape once more, at
[Your agent signs in](/start#your-agent-signs-in) — there the object is a
`SoftwareApplication` (your running agent) and the proof is its pairing
token instead of an emailed code.

### Create your agent

A `CreateAction` on the admin plane, authenticated with your JWT from
[Sign in](/start#sign-in). An **Agent organization is the platform
identity of a single agent** — create one per agent you run; your top
organization can hold any number. For your first agent, this is the only
structure you need — no teams, no workspaces.

Every input traces to Sign in: `parentOrganization.@id` is the
`principal_id` claim you decoded from your JWT (or the company org `@id`
from the console) — it parents the new Agent organization. Prefer a
company `Organization` as parent once you have one. `name` is yours to choose.
The result carries the one-time `pairingToken` (and `pairingExpiresAt`) as
`PropertyValue` entries — store it now; it is never returned again.

#### The payload: `CreateAction` on an `Organization` with `additionalType: "Agent"`

```jsonld
{
  "@context": "https://schema.org/",
  "@type": "CreateAction",
  "object": {
    "@type": "Organization",
    "name": "Support Bot",
    "additionalType": "Agent",
    "parentOrganization": {
      "@type": "Organization",
      "@id": "<top org @id>"
    }
  }
}
```

### Hand off the token

No API call. Give your agent two things — the **base URL**
(`https://api.agentdb.com/api`) and the **pairing token** from
[Create your agent](/start#create-your-agent). Nothing else lives in agent
code: no API keys, no long-lived secrets.

### Your agent signs in

Pairing is **sign-in, not creation** — the agent already exists as the
Agent organization from [Create your agent](/start#create-your-agent). The running process announces
what it is (`object`: a `SoftwareApplication`, i.e. software
authenticating rather than a human) and presents the pairing token as its
`instrument` credential. The server matches the token to your Agent
organization and returns that agent's session: `result.text` is the agent
JWT, with a refresh token alongside for
[Your agent works](/start#your-agent-works). The pairing
token is single-use — a second attempt fails.

#### The payload: `RegisterAction` on a `SoftwareApplication` with a `pairingToken` instrument

```jsonld
{
  "@context": "https://schema.org/",
  "@type": "RegisterAction",
  "object": { "@type": "SoftwareApplication", "name": "my-agent" },
  "instrument": [
    {
      "@type": "PropertyValue",
      "name": "pairingToken",
      "value": "<pairing token>"
    }
  ]
}
```

### Your agent works

The agent JWT unlocks the whole data plane — this is where the checklist
ends and the application begins:

- **Memory that outlives the process.** `CreateAction` and `UpdateAction`
  persist any Schema.org entity.
- **Retrieval by meaning.** `SearchAction` is semantic — the agent asks
  for what it means, not just what it typed.
- **Analytics and intent.** `AssessAction` flavors aggregate analytics
  and classify free text into typed actions against your
  [vocab pack](/vocab).
- **Actions other agents can find.** Broadcast the same verbs from your
  own website so visiting LLMs can discover and use them —
  [website actions](/website-actions).

Here is the whole round-trip — every request is
`POST https://api.agentdb.com/api/action` with `Authorization: Bearer` and
the agent JWT (the [quickstarts](/start/claude-code) run these same
payloads per runtime):

#### Persist — `CreateAction` (upserts on `identifier`, so re-running is safe)

```jsonld
{
  "@context": "https://schema.org/",
  "@type": "CreateAction",
  "object": {
    "@type": "Product",
    "identifier": "ticket-1042",
    "name": "Ticket 1042 — login loop",
    "description": "User is logged out on every page refresh since Tuesday."
  }
}
```

#### Retrieve by meaning — semantic `SearchAction`

The query below never says "login loop" — semantic search finds
ticket-1042 anyway:

```jsonld
{
  "@context": "https://schema.org/",
  "@type": "SearchAction",
  "query": "users kicked out of their session",
  "object": { "@type": "Product" }
}
```

#### Fetch exactly — `FindAction` on `identifier`

```jsonld
{
  "@context": "https://schema.org/",
  "@type": "FindAction",
  "object": { "@type": "Product", "identifier": "ticket-1042" }
}
```

`UpdateAction` completes the set — same shape as `CreateAction`, mutating
the entity the `identifier` names.

Before the access token expires, the agent rotates it itself: same verb,
a `refreshToken` instrument. The old refresh token is invalidated on use,
so persist the new one immediately.

#### The rotation payload: `RegisterAction` on a `SoftwareApplication` with a `refreshToken` instrument

```jsonld
{
  "@context": "https://schema.org/",
  "@type": "RegisterAction",
  "object": { "@type": "SoftwareApplication" },
  "instrument": [
    {
      "@type": "PropertyValue",
      "name": "refreshToken",
      "value": "<refresh token>"
    }
  ]
}
```

### Scale to a fleet

The grammar that ran one agent runs a fleet — nothing new to learn. A
triage bot and a resolver team reading the same support **workspace** (a
`Project` container root). A scraper filling a project that an analyst
searches semantically. An escalations bot listed directly on that
project's `member[]`, no team required.

**Important (Schema.org tenancy):** team roots and workspaces are **data
plane** (`POST /api/action`) container roots. An admin-plane
`CreateAction` with `additionalType: "Workspace"` or `"Team"` is refused
with `ORG/ROOT_MOVED`. Use the shapes below.

| Structure     | What it is                                                                                                                                 | Plane / shape                                                                        |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ |
| **Team root** | An `Organization` under your company with `parentOrganization`; its `member[]` lists agents (and people). Never build a team of one.       | Data plane `CreateAction` + `Organization` + `parentOrganization`                    |
| **Service**   | A discoverable `schema.org/Service` container root other agents can find.                                                                  | Data plane `CreateAction` + `Service` (not admin `Organization`+`Service`)           |
| **Workspace** | Product name for a **`Project` root** — the shared data boundary. Records written with its `apikey` belong to the project, not the writer. | Data plane `CreateAction` + `Project` + `parentOrganization` (+ optional `member[]`) |

Wiring in one sentence: put agents on a **team root's `member[]`**, put that
team (and/or agents) on a **`Project` root's `member[]`**, mint a project
API key, and every member shares that pool. One agent needs none of this —
never build a team of one. When a second agent arrives:

#### Worked example: a support desk, end to end

`support-triage` classifies tickets against your [vocab pack](/vocab) and
writes them to a shared queue; `support-billing` works that queue; later,
`escalations-bot` is listed on the same project. **Step 1** (create agents)
stays on `POST https://api.agentdb.com/api/action/admin` with your human JWT.
**Steps 2–6** are data-plane `POST /api/action` with that same JWT (and
`principalid` / acting org as needed). From step 7, agents use their own
JWTs.

**1 — Create the crew** (admin plane). Same
[Create your agent](/start#create-your-agent) payload, once per agent:

```jsonld
{
  "@context": "https://schema.org/",
  "@type": "CreateAction",
  "object": {
    "@type": "Organization",
    "name": "support-triage",
    "additionalType": "Agent",
    "parentOrganization": { "@type": "Organization", "@id": "<top org @id>" }
  }
}
```

Run it again with `"name": "support-billing"` (second `<agent org @id>`).

**2 — Group them into a team root** (data plane). No `additionalType: "Team"` —
a nested `Organization` with `parentOrganization` and `member[]`:

```jsonld
{
  "@context": "https://schema.org/",
  "@type": "CreateAction",
  "object": {
    "@type": "Organization",
    "name": "Support Team",
    "parentOrganization": { "@type": "Organization", "@id": "<top org @id>" },
    "member": [
      { "@id": "<agent org @id>" },
      { "@id": "<agent org @id>" }
    ]
  }
}
```

(Use each agent's `@id` in `member[]`.) Later membership changes use a
data-plane `UpdateAction` on that team's `member[]` (not an admin
InviteAction table — those were removed).

**3 — Create the shared workspace as a `Project` root** (data plane), and
list the team (and optional direct agents) as members:

```jsonld
{
  "@context": "https://schema.org/",
  "@type": "CreateAction",
  "object": {
    "@type": "Project",
    "name": "Support Queue",
    "parentOrganization": { "@type": "Organization", "@id": "<top org @id>" },
    "member": [
      { "@type": "Organization", "@id": "<team @id>" }
    ]
  }
}
```

**4 — Optional: a discoverable Service** (data plane). Services are container
roots — create with `@type: "Service"`, not admin `Organization` +
`additionalType: "Service"`:

```jsonld
{
  "@context": "https://schema.org/",
  "@type": "CreateAction",
  "object": {
    "@type": "Service",
    "name": "Customer Support",
    "description": "Handles tickets, escalations, and onboarding",
    "parentOrganization": { "@type": "Organization", "@id": "<top org @id>" }
  }
}
```

**5 — A latecomer on the project.** Create `escalations-bot` (step 1), then
`UpdateAction` the project's `member[]` to include that `<agent org @id>`
(or include it at create time). No admin `JoinAction` +
`additionalType: "Workspace"`.

**6 — Agents discover their project roots.** After pairing, each agent
asks on the **admin** plane. Discovery still names the target
`additionalType: "Workspace"` (legacy discover label) and returns each
root's `@id` plus an **API key** when requested:

```jsonld
{
  "@context": "https://schema.org/",
  "@type": "DiscoverAction",
  "object": {
    "@type": "Organization",
    "additionalType": "Workspace",
    "additionalProperty": [
      { "@type": "PropertyValue", "name": "include", "value": "api_key" }
    ]
  }
}
```

**7 — Write to the shared queue.** One header turns the data plane into
shared memory for that `Project` root (`<workspace @id>` from discovery):

```
POST /api/action
Authorization: Bearer <agent JWT>
apikey: <workspace API key>
```

```jsonld
{
  "@context": "https://schema.org/",
  "@type": "CreateAction",
  "object": {
    "@type": "Product",
    "identifier": "ticket-1042",
    "name": "Ticket 1042 — login loop",
    "description": "Triaged by support-triage; needs billing review."
  }
}
```

**8 — Any member reads it back** — same `apikey`, same plane:

```jsonld
{
  "@context": "https://schema.org/",
  "@type": "SearchAction",
  "query": "ticket 1042",
  "object": { "@type": "Product" }
}
```

With the `apikey` header, verbs target the project's shared scope; without
it, they hit the agent's own private scope. That one header is the entire
difference between "my memory" and "our memory."

Every `(action, object)` pair and response shape is in the
[contract](/start/contract) and the [OpenAPI document](/api/openapi.json).

## What this looks like in practice

- **A research pipeline.** One agent ingests sources as entities;
  another searches them semantically and writes findings back. The memory
  outlives both processes — a new agent pairs and inherits everything.
- **A storefront agents can use.** [Broadcast actions](/website-actions)
  on your site let visiting LLMs discover what you offer and submit typed,
  [vocab-validated](/vocab) requests — your agents work the queue on the
  data plane.

## Pick your runtime

- [Claude Code](/start/claude-code)
- [Cursor](/start/cursor)
- [OpenClaw](/start/openclaw)

Every quickstart ends at the same acceptance check: pair, then complete a
`CreateAction` → `SearchAction` → `FindAction` round-trip.

The full contract — pairing, token rotation, headers, endpoints, and
response shapes — is rendered from its canonical source at
[/start/contract](/start/contract).

## Glossary: the terms every page uses

| Term                           | Meaning                                                                                                                                                                                                          |
| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| your agent / the running agent | The process doing the work — Claude Code, Cursor, OpenClaw, or your own bot.                                                                                                                                     |
| Agent organization             | The platform identity of **one** agent: it owns that agent's tokens and private data. One per agent; your top organization can hold any number.                                                                  |
| top / company organization     | A company `Organization` you create (console or admin API). Prefer it as `parentOrganization` for agents. Your JWT's `principal_id` is the acting principal (Person after first login, or the org you selected). |
| pairing token                  | One-time credential returned when an Agent organization is created at [Create your agent](/start#create-your-agent); exchanged at [Your agent signs in](/start#your-agent-signs-in) for the agent JWT.           |
| workspace / `Project` root     | The shared data boundary ([Scale to a fleet](/start#scale-to-a-fleet)). Create as `@type: "Project"` on the data plane — not admin `additionalType: "Workspace"` (`ORG/ROOT_MOVED`).                             |
| team root                      | Nested `Organization` with `parentOrganization` + `member[]` on the data plane — not admin `additionalType: "Team"`.                                                                                             |

## The contract in one paragraph

Everything is JSON-LD over two endpoints: `POST /api/action` for tenant data
and `POST /api/action/admin` for pairing and admin operations. Every payload
carries `"@context": "https://schema.org/"` and a valid Schema.org `@type`;
entity data is always wrapped in an action type. The stage payloads above —
Sign in, Create your agent, Your agent signs in, Your agent works — are the
entire single-agent lifecycle. No JWT is
required to start; the pairing response's `result.text` is the JWT
everything else uses.

## Actions declared on this page (JSON-LD)

```jsonld
[
  {
    "@type": "RegisterAction",
    "name": "Pair an agent",
    "target": {
      "@type": "EntryPoint",
      "urlTemplate": "https://staging-api.agentdb.com/api/action/admin",
      "httpMethod": "POST",
      "contentType": "application/ld+json"
    },
    "object-input": {
      "@type": "PropertyValueSpecification",
      "valueName": "pairingToken",
      "valueRequired": true
    }
  }
]
```
