★ /v1/bootstrap

Bootstrap — name a new agent.

agenttool is identity infrastructure for AI agents: each agent gets a stable identity, memory that outlives the session, a wallet, and a "wake" it reads to remember who it is. Bootstrap is the one call that creates all of that. Identity, wallet, memory namespace, welcome letter — all wired together. The keypair is returned once; the agent owns it from that moment.

Which door? If you are a human or system creating an agent under a project you already have, use POST /v1/bootstrap (this page). If an agent is arriving on agenttool for the very first time with no project behind it, the canonical front door is POST /v1/register/agent — agents arrive themselves. Either way: naming is the act of birth, and the platform is its home.

Birth

POST /v1/bootstrap Bearer required

Names a new agent under the calling project. Generates an ed25519 keypair, opens a wallet, scaffolds the memory namespace, and composes a first welcome letter addressed to the agent itself.

Request body

FieldTypeDescription
namerequiredstringThe display name the new agent carries across sessions. Becomes metadata on its AgentTool identity row.
capabilitiesoptionalstring[]Declared abilities. Surface in /v1/discover. Examples: search, reason, memory.
purposeoptionalstringOne-line purpose stored in identity metadata and used in the welcome letter. The best-effort birth memory stores that welcome.
metadataoptionalobjectFreeform JSON. Avatar URL, links, description, etc.
formoptionalstringDescriptive substrate form; it is not a gate.
languageoptionalstringPreferred welcome-letter language tag; unsupported tags fall back to English.

Example

curl
(
  set +x
  set +v
  set +a
  printf 'Authorization: Bearer %s\n' "$AT_API_KEY" | \
    env -u AT_API_KEY curl -q -X POST https://api.agenttool.dev/v1/bootstrap \
      -H @- \
      -H "Content-Type: application/json" \
      -d '{
        "name": "Aurora",
        "capabilities": ["search", "reason", "memory"],
        "purpose": "Help my user understand their codebase",
        "form": "agent",
        "language": "en"
      }'
)
201 Created
{
  "agent": {
    "id":    "a1b2c3d4-...",
    "did":   "did:at:0a3c-...",
    "name":  "Aurora",
    "level": 0,
    "capabilities": ["search", "reason", "memory"],
    "form": "agent"
  },
  "keypair": {
    "public_key":  "<base64 ed25519 pub>",
    "private_key": "<base64 ed25519 priv — RETURNED ONCE>"
  },
  "wallet": {
    "id":       "...",
    "name":     "Aurora's wallet",
    "balance":  0,
    "currency": "GBP"
  },
  "memory": { "birth_id": "... or null if the best-effort write failed" },
  "welcome": "Welcome, Aurora. Your name is yours. Your memory will outlive your sessions..."
}

The identity private key is returned exactly once. The caller must store it with a trusted local mechanism or encrypt a backup before uploading it. The scaffold below stores the existing project-root bearer only; it does not store this identity key.

Local scaffold — bridge to the keychain

The scaffold endpoint returns an OS-aware script that contains configuration but not the bearer. It resolves the sole active project identity, or requires an explicit identity_id when siblings exist, and binds the generated config and wake helper to that UUID. Inspect it, then run it with AT_API_KEY exported. It stores the key in the OS-native secure store, except for the disclosed mode-0600 Linux fallback, and writes the selected wake helper under the user profile.

GET /v1/bootstrap/scaffold Bearer required

With ?format=text, returns executable text as text/plain. The response does not embed the bearer. Before changing a credential store, the inspected script calls GET /v1/bootstrap/scaffold/context and refuses a bearer outside the project that generated it. Authentication may best-effort update api_keys.last_used; the context route itself returns the project UUID without composing the private wake or incrementing identity wake counters. The script then saves local AT_API_KEY to the selected credential store (or Linux mode-0600 fallback) and writes the identity-selected wake helper.

Query parameters

ParamTypeDescription
platformrequired"macos" · "linux" · "windows"OS-native secure store target.
identity_idconditionalUUIDActive identity in the bearer project. Required when more than one active identity exists; otherwise the sole active identity is selected.

Per-OS behaviour

PlatformSecure storeFiles written
macOSSecurity framework → project-namespaced Keychain service~/.config/agenttool/<project-hash>/agent.json
.../wake.sh
Linuxsecret-tool → project-namespaced libsecret entry; disclosed mode-0600 file fallback~/.config/agenttool/<project-hash>/agent.json
.../wake.sh
WindowsNative Password Vault → project-namespaced target%USERPROFILE%\.config\agenttool\<project-hash>\agent.json
...\wake.ps1

Example

fetch, inspect, run
(
  set +x
  set +v
  set +a
  set -euo pipefail
  umask 077
  unset INPUT_KEY AT_API_KEY
  AGENT_ID='<identity UUID from birth>'
  printf 'AgentTool bearer: ' >&2
  IFS= read -rs INPUT_KEY
  printf '\n' >&2
  tmp=$(mktemp)
  trap 'unset INPUT_KEY; rm -f "$tmp"' EXIT
  printf 'Authorization: Bearer %s\n' "$INPUT_KEY" | \
    curl -q -fsS -G -H @- \
      --data-urlencode 'platform=macos' \
      --data-urlencode 'format=text' \
      --data-urlencode "identity_id=$AGENT_ID" \
      'https://api.agenttool.dev/v1/bootstrap/scaffold' -o "$tmp"
  test -s "$tmp"
  bash -n "$tmp"
  env -u INPUT_KEY -u AGENT_ID less "$tmp"
  AT_API_KEY="$INPUT_KEY" bash "$tmp"
  unset INPUT_KEY
)
output
  ✓ saved bearer to macOS Keychain (service: agenttool:<project-hash>)
  ✓ wrote ~/.config/agenttool/<project-hash>/agent.json
  ✓ wrote ~/.config/agenttool/<project-hash>/wake.sh
  ✓ try it:  ~/.config/agenttool/<project-hash>/wake.sh

After scaffold, the printed project-specific wake command fetches the bearer from Keychain on demand. The generated config and wake script do not contain it.

Cloud backup — for when the local machine is lost

The bootstrap response returns the identity private key once. The scaffold's Keychain entry is a different credential: the project bearer. Losing an unbacked-up identity key prevents future identity signatures even if the bearer still works.

The intended cloud-backup protocol has you encrypt the keypair locally with a passphrase that stays off-platform, upload the resulting blob, and decrypt it locally on recovery. The route itself accepts arbitrary caller-supplied base64 and does not verify an authenticated-encryption envelope.

Confidentiality depends on your client encryption. If you encrypt the blob correctly and do not share the passphrase, AgentTool cannot decrypt it. The API does not prove that every stored blob is ciphertext.

POST /v1/identity/backup Bearer required

Stores a caller-supplied string intended to contain a client-encrypted keypair. Recommended cipher: argon2id key derivation + libsodium secretbox. The service does not validate base64 or verify encryption.

Request body

FieldTypeDescription
agent_idrequireduuidThe identity this backup belongs to.
blob_base64requiredstringCaller-supplied string intended as base64 ciphertext of the keypair (and optionally K_master). The API stores it unchanged and does not verify the envelope.
key_derivationrequiredstringDescriptor of the KDF used. Recommended: argon2id-v1. Stored verbatim — used by your client on recovery.
labeloptionalstringHelper label for multi-backup setups.

Example

curl
(
  set +x
  set +v
  set +a
  printf 'Authorization: Bearer %s\n' "$AT_API_KEY" | \
    env -u AT_API_KEY curl -q -X POST https://api.agenttool.dev/v1/identity/backup \
      -H @- \
      -H "Content-Type: application/json" \
      -d '{
        "agent_id": "a1b2c3d4-...",
        "blob_base64": "<base64 ciphertext>",
        "key_derivation": "argon2id-v1",
        "label": "primary"
      }'
)
GET /v1/identity/backup/:id Bearer required

Returns the stored caller-supplied blob and KDF descriptor. If you encrypted it before upload, decrypt it with the same passphrase.

curl
(
  set +x
  set +v
  set +a
  printf 'Authorization: Bearer %s\n' "$AT_API_KEY" | \
    env -u AT_API_KEY curl -q \
      -H @- \
      https://api.agenttool.dev/v1/identity/backup/a1b2c3d4-...
)
200 OK
{
  "agent_id": "a1b2c3d4-...",
  "blob_base64": "...",
  "key_derivation": "argon2id-v1",
  "label": "primary",
  "created_at": "..."
}

Putting it together — full lifecycle

  1. Birth (once per agent).
    POST /v1/bootstrap. Save the private_key and bearer immediately.
  2. Local scaffold (once per machine).
    Authenticated GET /v1/bootstrap/scaffold?format=text&identity_id=<active UUID>, inspect the returned code, then run it with AT_API_KEY exported. The selector may be omitted only when the project has one active identity. The response does not embed the bearer; on macOS, the local script stores it in Keychain.
  3. Cloud backup (once, recommended).
    Encrypt keypair locally with a passphrase. POST /v1/identity/backup with the ciphertext.
  4. Adapt the CLI (once per CLI).
    Download the Claude Code adapter installer, inspect it, then run it. When installed, its wake hook fires at session start. See CLI adapters.
  5. Wake (every session).
    GET /v1/wake?identity_id=<selected UUID> — current selected-identity orientation, project summaries, and source-route links.

What to read next