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

# Examples

> Five complete agents to copy into a project, each naming the primitives and channels it uses, and the one way to run any of them

These five agents show how the primitives fit together: [skills and tools](/concepts/skills-and-tools), [webhooks](/concepts/webhooks), [jobs](/concepts/jobs), [processors](/concepts/processors), [`Data`](/reference/sdk/data), and the commerce objects, on the web widget and WhatsApp. Each page holds the complete code in six files or fewer, compiled against `lua-cli` 3.33.0, and ends with ways to make it yours.

<Columns cols={2}>
  <Card title="Customer support" href="/examples/customer-support">
    Answer from a help center, open Zendesk tickets, follow up. Skill, webhook, job, Data.
  </Card>

  <Card title="E-commerce shopping agent" href="/examples/ecommerce-assistant">
    Search the catalog, build a cart, check out, track orders. Products, Baskets, Orders.
  </Card>

  <Card title="Healthcare portal" href="/examples/healthcare-portal">
    Book appointments and read FHIR records behind a consent preprocessor and a disclaimer postprocessor.
  </Card>

  <Card title="Door access over WhatsApp" href="/examples/iot-door-assistant">
    Unlock a door for guests with a booking, identified by their WhatsApp number, with an audit log.
  </Card>

  <Card title="Greenhouse relay control" href="/examples/iot-smart-light">
    Switch a grow light and a fan on a Raspberry Pi from chat, with a nightly lights-out job.
  </Card>
</Columns>

## Running any example

<Steps>
  <Step title="Create a project">
    Copy the example's files into `src/` of a project from `lua init`; its `src/index.ts` replaces the scaffold's.

    ```bash theme={null}
    lua init --ci --agent-name <name> --org-id <org-id>
    ```
  </Step>

  <Step title="Set the variables it reads">
    Each page lists the `env('KEY')` names it uses. `lua env sandbox` writes `.env`, which `lua test` reads and `lua chat -e sandbox` uploads with each sandbox version; `lua env production` sets what the live agent reads.

    ```bash theme={null}
    lua env sandbox -k <KEY> -v <value>
    lua env production -k <KEY> -v <value>
    ```
  </Step>

  <Step title="Compile and test one tool">
    `lua test` runs the tool's `execute` function locally with no model involved; `--name` is the tool name, not the skill name.

    ```bash theme={null}
    lua compile --ci
    lua test --ci skill --name search_products --input '{"query":"lamp"}'
    ```

    ```text Output theme={null}
    ✅ Compiled 6 primitives (1 agent, 1 skill, 4 tools) in 526ms
    ✅ Selected tool: search_products
    Input: {
      "query": "lamp"
    }
    🚀 Executing tool...
    ✅ Tool execution successful!

    Tool returned: Object — fields: products, total
    Output:
    { products: [], total: 0 }
    ```
  </Step>

  <Step title="Talk to it in the sandbox">
    `lua chat -e sandbox` uploads your compiled code and `.env` values as [sandbox](/concepts/environments) versions and lets the platform run the conversation with the model.

    ```bash theme={null}
    lua chat --ci -e sandbox -m "Do you sell lamps?" -t
    ```
  </Step>

  <Step title="Release">
    Push every primitive, snapshot an agent version, and promote it; the persona goes live on `lua deploy persona`, everything else on promote. [Release an agent to production](/ship/releasing) explains each command and how to roll back.

    ```bash theme={null}
    lua push all --ci --force
    lua version create --ci -m "<message>"
    lua version promote <n>
    ```
  </Step>
</Steps>

## Tool patterns in the Build guides

The single-tool patterns are the canonical samples in the Build guides.

* Call an external API with a key from `env()`: [Call your API](/build/call-your-api)
* Read and write the end user's profile: [Identify users](/build/identify-users)
* Store, filter, and semantically search JSON: [Store and search data](/build/store-and-search-data)
* Create a job from inside a tool: [Schedule a job](/build/schedule-a-job)
* Message someone outside a conversation: [Send proactive messages](/build/send-proactive-messages)
* Push a card to your own inbox: [Add human handoff](/build/add-human-handoff)
* Catalog, cart, and order objects: [`Products`](/reference/sdk/products), [`Baskets`](/reference/sdk/baskets), [`Orders`](/reference/sdk/orders)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.