> ## 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](https://docs.heylua.ai/concepts/skills-and-tools.md), [webhooks](https://docs.heylua.ai/concepts/webhooks.md), [jobs](https://docs.heylua.ai/concepts/jobs.md), [processors](https://docs.heylua.ai/concepts/processors.md), [`Data`](https://docs.heylua.ai/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.

> [card] [Customer support](https://docs.heylua.ai/examples/customer-support.md)
>
> Answer from a help center, open Zendesk tickets, follow up. Skill, webhook, job, Data.

> [card] [E-commerce shopping agent](https://docs.heylua.ai/examples/ecommerce-assistant.md)
>
> Search the catalog, build a cart, check out, track orders. Products, Baskets, Orders.

> [card] [Healthcare portal](https://docs.heylua.ai/examples/healthcare-portal.md)
>
> Book appointments and read FHIR records behind a consent preprocessor and a disclaimer postprocessor.

> [card] [Door access over WhatsApp](https://docs.heylua.ai/examples/iot-door-assistant.md)
>
> Unlock a door for guests with a booking, identified by their WhatsApp number, with an audit log.

> [card] [Greenhouse relay control](https://docs.heylua.ai/examples/iot-smart-light.md)
>
> Switch a grow light and a fan on a Raspberry Pi from chat, with a nightly lights-out job.

## Running any example

**1. 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>
```

**2. 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>
```

**3. 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 }
```

**4. Talk to it in the sandbox**

`lua chat -e sandbox` uploads your compiled code and `.env` values as [sandbox](https://docs.heylua.ai/concepts/environments.md) 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
```

**5. 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](https://docs.heylua.ai/ship/releasing.md) 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>
```

## 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](https://docs.heylua.ai/build/call-your-api.md)
* Read and write the end user's profile: [Identify users](https://docs.heylua.ai/build/identify-users.md)
* Store, filter, and semantically search JSON: [Store and search data](https://docs.heylua.ai/build/store-and-search-data.md)
* Create a job from inside a tool: [Schedule a job](https://docs.heylua.ai/build/schedule-a-job.md)
* Message someone outside a conversation: [Send proactive messages](https://docs.heylua.ai/build/send-proactive-messages.md)
* Push a card to your own inbox: [Add human handoff](https://docs.heylua.ai/build/add-human-handoff.md)
* Catalog, cart, and order objects: [`Products`](https://docs.heylua.ai/reference/sdk/products), [`Baskets`](https://docs.heylua.ai/reference/sdk/baskets), [`Orders`](https://docs.heylua.ai/reference/sdk/orders)


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