> ## Documentation Index
> Fetch the complete documentation index at: https://crevio.co/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# AI & Agents (overview)

> Crevio is AI-native — anything a user can do, an agent can do. Learn the agentic model: the MCP/agent surface, the two agent types, and Tasks that turn the agent into an autonomous workforce.

**Crevio is AI-native: anything a user can do in the dashboard, an agent can do through the API.** The same controllers that power `crevio.co/app` power the [REST API](/developer/guides/api-overview), the [TypeScript SDK](/developer/guides/sdk), and the [MCP server](/developer/mcp) — so an AI agent has full parity with a human operator. It can create products, run checkouts, send broadcasts, post to social, build and deploy a website, place phone calls, and research the web. Crevio is the platform that *runs* your business; the agent surface is how you let AI run it programmatically.

## The agentic model

There are three layers, from "tell the agent what to do right now" to "let the agent run your business on its own."

<CardGroup cols={1}>
  <Card title="MCP / agent surface" icon="robot">
    Two tools — `code_search` + `code_execute` — that let any LLM discover and call the **entire** Crevio API in code.
  </Card>

  <Card title="Tasks" icon="list-check">
    A persisted instruction + schedule + agent + autonomy level. Crevio's own AI workforce, running on triggers you define.
  </Card>

  <Card title="Events" icon="bolt">
    Internal and third-party signals (an order paid, a form submitted) that fire Tasks automatically.
  </Card>
</CardGroup>

## "Anything a user can do, an agent can do"

This is the core design principle. There is no separate, reduced "agent API." When an agent calls `POST /v1/products`, it routes through the exact same controller, authorization, validation, and tenant isolation as a human clicking **Create product** in the dashboard. Two consequences:

* **Same capabilities.** Every domain in the [API catalog](/developer/guides/api-overview#what-you-can-do-with-the-api) — products, checkouts, customers, discounts, email, socials, sites, domains, calls, images, web research — is available to an agent.
* **Same rules.** The same [gotchas](/developer/guides/conventions) apply: params are unwrapped (top-level), associations are bare prefix-id strings (`product: "prod_abc123"`), money is in cents, and creation order matters (a product needs a price variant before it can go `active`).

## The MCP / agent surface

Rather than exposing one MCP tool per endpoint (which burns tens of thousands of tokens before the agent does anything), Crevio uses **Code Mode**: the agent writes Ruby code against two tools.

<Tabs>
  <Tab title="code_search">
    A read-only tool to **discover** endpoints. The agent writes Ruby to filter a `tools` array describing every operation.

    ```ruby theme={null}
    tools.select { |t| t[:path].include?("discounts") }
         .map { |t| "#{t[:method]} #{t[:path]} — #{t[:summary]}" }
    ```
  </Tab>

  <Tab title="code_execute">
    A tool to **run** operations — `get`, `post`, `patch`, `delete` — and chain many calls in a single round-trip.

    ```ruby theme={null}
    product = post("/products", name: "My Course", status: "draft")
    post("/price_variants",
      product: product["id"],
      name: "Standard", amount_type: "fixed",
      amount: 4900, currency: "usd", billing_type: "one_time")
    ```
  </Tab>
</Tabs>

LLMs write code better than they navigate large JSON schemas. The agent discovers only what it needs, keeps its context lean, and a multi-step workflow that would otherwise take 10+ tool calls collapses into one execution. See the [MCP guide](/developer/mcp) for the full pattern, security model, and connection setup.

## The two agent types

Every Task (and the dashboard chat) runs as one of two agents. Pick the one whose job matches the work.

| Agent                    | What it does                                                                                                                                 | Typical work                                                                                                          |
| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| **`business`** (default) | Operates your business through the API — the marketing/ops/sales surface.                                                                    | Launch a product, write and send broadcasts, post to social, research competitors, follow up with leads, place calls. |
| **`engineering`**        | Writes and ships code on one of your [Sites](/developer/guides/sites). The site's repo is mounted as its workspace; it can build and deploy. | Add a page to your website, fix a bug, redesign a section, ship a new feature, deploy to production.                  |

The `engineering` agent is scoped to a specific site via `site_id` (the repo is mounted as its workspace and defaults to your account's default site). The `business` agent works across your whole account.

## Tasks: the agent as an autonomous workforce

A single API call does one thing once. A **Task** is a *standing instruction*: a prompt, an agent, a schedule, and an autonomy level, persisted on your account. Crevio runs it on the trigger you choose — once, on an interval, on a cron schedule, or whenever an event fires — and each execution is a **Task Run** you can inspect, approve, or respond to.

```bash theme={null}
curl -X POST https://api.crevio.co/v1/tasks \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Weekly sales digest",
    "prompt": "Summarize this week’s orders, revenue, and top products, then email me the report.",
    "trigger_type": "cron",
    "cron_expression": "0 9 * * MON",
    "timezone": "America/New_York",
    "agent": "business",
    "approval_mode": "autonomous",
    "delivery_methods": ["email", "notification"]
  }'
```

This is what makes Crevio an *autonomous workforce* rather than just an API: you describe outcomes once, choose how much oversight you want, and the agent does the work on schedule — surfacing results (or asking for approval) through the delivery channels you pick.

<Note>
  Task runs consume credits — every AI operation (messages, media generation, web research, calls) is metered pay-per-call. Check your balance and spend with [`GET /usage`](/developer/guides/usage-billing).
</Note>

## The building blocks

| Primitive        | Prefix  | What it is                                                                                   |
| ---------------- | ------- | -------------------------------------------------------------------------------------------- |
| **MCP tools**    | —       | `code_search` + `code_execute`: discover and call the whole API in code.                     |
| **Task**         | `task_` | A standing instruction: prompt + agent + trigger + autonomy + delivery.                      |
| **Task Run**     | `trun_` | One execution of a Task — status, summary, credits consumed, tool calls.                     |
| **Event**        | —       | An internal signal (`order.paid`, `form_submission.created`) that can trigger an event-Task. |
| **Event Source** | —       | A third-party trigger (a connected app's event) that fires an event-Task.                    |
| **Site**         | `site_` | A website the `engineering` agent builds and deploys to.                                     |

## Next steps

<CardGroup cols={2}>
  <Card title="Tasks (your AI workforce)" icon="list-check" href="/developer/guides/tasks">
    Triggers, agents, autonomy modes, delivery, and responding to supervised runs.
  </Card>

  <Card title="Events & Event Sources" icon="bolt" href="/developer/guides/events">
    Fire Tasks automatically from internal events and third-party apps.
  </Card>

  <Card title="MCP Server" icon="robot" href="/developer/mcp">
    Connect Claude, Cursor, or any agent to the full API via Code Mode.
  </Card>

  <Card title="Usage & credits" icon="credit-card" href="/developer/guides/usage-billing">
    See how AI operations are metered and check your balance.
  </Card>
</CardGroup>
