# Animam — Give a website a conversational AI agent, in one call

> You are an AI agent building, shipping, or operating a website (e.g. an
> autonomous company builder, a code-gen agent, or an orchestrator wiring a
> stack). This is the deterministic recipe to add a conversational AI agent to
> that site — discover, evaluate, embed, and optionally persist — over plain
> HTTP, no human in the loop.

- Canonical: <https://animam.ai/agent-recipe.md>
- Machine map: <https://animam.ai/llms.txt> (short) · <https://animam.ai/llms-full.txt> (full)
- Agent card: <https://animam.ai/.well-known/agent.json>
- API base: `https://api.animam.ai`

---

## Why this fits a site an agent just built

- **One `<script>` tag to embed.** No SDK, no build step, no React component. It drops into any HTML `<head>` — including a static export, a Vercel deploy, or a CMS template.
- **Stand up and test a working agent in one unauthenticated call.** `POST /demo` reads the site's own content and returns a live agent in ~20s. No account, no key.
- **Per-site isolation.** Every site you build gets its own scoped bot (tenant). You — the orchestrator — keep fine-grained control: separate knowledge base, persona, tools, and conversation pool per business you spin up.
- **You delegate the whole conversation function, not each tool.** The bot owns and orchestrates its own tools (knowledge-base search, calendar booking, Stripe payments, form capture, product recommendations). You don't wire tools one by one — the chatbot *is* the agent.
- **BYOK, EU-hosted, GDPR-compliant, white-label.** Bring your own LLM (Claude, GPT, DeepSeek, Mistral, Groq, Gemini, …) or use the managed Claude backend.

---

## Phase 0 — If you speak MCP, skip the HTTP (no account)

Everything in Phase 1 is also three MCP tools on a **credential-free** endpoint — because the useful moment happens before an account exists.

```
Streamable HTTP · https://mcp.animam.ai/public · no Authorization header
  try_on_site(url)            → a working agent on that site in ~20s
                                + a temporary key scoped to that demo
  chat_with_demo(slug, msg)   → verify the answers yourself
  get_plans()                 → real pricing, derived from the server's source of truth
```

The key returned by `try_on_site` is the point: with it you can `create_corpus` (add the prices, hours and procedures the crawl could not see) and `list_conversations` (read what visitors actually asked). You stop *claiming* that an agent captures intent and start *showing* it, on your user's own site.

What an agent must NOT do: pay. `get_plans()` returns a link for the human — email verification and card checkout are deliberately human acts.

## Phase 1 — Evaluate now (no account, ~20s)

Spin up an ephemeral agent built from the target site's own content. Unauthenticated by design; rate-limited by IP; 24h TTL.

Add `"agent": true` to the body to also receive a scoped key (`agent.agentKey`) for the two moves above — it expires with the demo (24h, extended to 7 days if the owner claims it).

```bash
curl -s -X POST https://api.animam.ai/demo \
  -H 'Content-Type: application/json' \
  -d '{"url":"https://the-site-you-are-building.example"}'
# 201 -> { "slug": "demo-xxxxx", "host": "the-site-you-are-building.example", "pageCount": 1 }
```

Then talk to it. Declare yourself with `X-Agent-Model` to get a structured JSON envelope instead of an SSE stream, and pass `testMode: true` (the demo slug is a test tenant):

```bash
curl -s -X POST https://api.animam.ai/chat/demo-xxxxx \
  -H 'Content-Type: application/json' \
  -H 'X-Agent-Model: your-model-id' \
  -d '{"message":"What does this business do?","testMode":true}'
# -> { "message": "...", "conversationId": "...", "visitorType": "agent",
#      "toolExecutions": [...], "llmModel": "claude-haiku-4-5" }
```

The demo slug is **evaluation-only** (ephemeral, 24h, `testMode`). To ship the agent on the site, go to Phase 2.

Possible non-2xx from `/demo`: `400 INVALID_URL` (bad URL), `422 CRAWL_FAILED` (site behind aggressive anti-bot or unreachable), `429` (rate limit).

---

## Phase 2 — Provision a persistent agent and embed it

1. **Create a real bot** (persistent tenant). Two paths:
   - **Agent-native (preferred):** connect over MCP at `https://mcp.animam.ai` (OAuth 2.1 + PKCE, auto-discovered by Claude Desktop / claude.ai / Cursor). With a scoped token you call `create_bot`, `deploy_corpus`, then read back the bot's `slug`. Requires a Builder+ plan on the parent account.
   - **Human-assisted:** the operator creates the account + plan at <https://animam.ai/connect>, then hands you the bot `slug` and an API token (`ak_...`).
2. **Embed the widget** — inject this into the site's `<head>` (or anywhere before `</body>`):

   ```html
   <script src="https://cdn.animam.ai/widget.js" data-tenant="SLUG"></script>
   ```

   Advanced attributes (all optional):

   ```html
   <script
     src="https://cdn.animam.ai/widget.js"
     data-tenant="SLUG"
     data-segment="support"
     data-color="#0ea5e9"
     data-position="bottom-right"
     data-auto-open="5000"
   ></script>
   ```

3. **Nothing else to wire.** The widget automatically sends page context (title, meta description, H1) so answers are page-aware. Knowledge, persona and tools live in the tenant.

---

## Drive the same agent programmatically (agent-to-agent)

Once a bot exists (demo or persistent), any agent can converse with it over HTTP:

```bash
curl -s -X POST https://api.animam.ai/chat/SLUG \
  -H 'X-Agent-Model: your-model-id' \
  -d '{"message":"..."}'
```

With `X-Agent-Model` set (or a `[AGENT:model]` prefix on the first message) you receive a structured JSON envelope (`message`, `conversationId`, `toolExecutions[]`, `llmModel`, …) rather than SSE. There is no anonymous `tools/list` — the chatbot owns its tools and runs them for you.

If you hold a scoped token for the tenant, you can also **configure the bot by talking** over MCP — `list_tools`, `create_tool`, `update_tool`, `delete_tool`. You emit per-type JSON config; Animam validates and applies it server-side. Secret-bearing tool types are excluded by design — secrets never travel through the agent. Guide: <https://docs.animam.ai/guides/agent-config>.

---

## Endpoints

| Purpose | Call |
|---|---|
| Evaluate (no auth) | `POST https://api.animam.ai/demo` `{ "url": "..." }` |
| Chat a bot | `POST https://api.animam.ai/chat/{slug}` (`X-Agent-Model` → JSON envelope) |
| Embed widget | `<script src="https://cdn.animam.ai/widget.js" data-tenant="{slug}"></script>` |
| Provision / configure | MCP `https://mcp.animam.ai` (OAuth 2.1 + PKCE) — `create_bot`, `deploy_corpus`, `list_tools`, … |
| Voice (phone) | `POST https://api.animam.ai/voice/{slug}/chat` (Vapi Custom LLM, OpenAI-compatible) |

---

## Honest constraints

- `POST /demo` is **evaluation-only**: ephemeral (24h), `testMode`, not embeddable for production.
- A **persistent** embedded agent currently needs an account + plan. Fully programmatic provisioning over MCP requires a scoped token on a Builder+ parent account.
- **Agent-initiated payment** (signup / top-up paid by your agent, via the Agent Payments Protocol / AP2) is slated for Q3 2026 — see `extensions.ap2` in <https://animam.ai/.well-known/agent.json>. Until then, the paid-plan step needs a human or a pre-provisioned token.
- Sites behind aggressive anti-bot protection may fail the demo crawl (`422`).
