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

# Run agents

> Interact with agents through Slack, the CLI, and your own code.

Agents can be used in a variety of ways:

| Surface | Status | Best for |
| - | - | - |
| **Slack** | Available | The primary way Luno OS users interact with agents today, directly in Slack |
| **CLI** | Available | Testing and debugging agents during development |
| **HTTP API** | Available | Use agents via API and integrate them into your own services |
| **Workflow steps** | Available | Use agents as steps in deterministic workflows |
| **Triggers** | Available | Run an agent automatically on a schedule, webhook, or poll |
| **In-app chat** | Available | Chat with any deployed agent from its page in the Luno OS web app |
| **Microsoft Teams** | Available | Message the Luno bot 1:1 or `@mention` it in channels and group chats |
| **MCP server** | Available | Use agents and workflows as tools from any MCP client — see [MCP and A2A](https://docs.os.meetluno.ai/learn/agents/mcp-and-a2a.md) |
| **A2A** | Available | Let other agents call yours over the Agent-to-Agent protocol — see [MCP and A2A](https://docs.os.meetluno.ai/learn/agents/mcp-and-a2a.md) |
| **More channels** | Coming soon | Telegram, WhatsApp, Linear, and more |

## Use agents in Slack

Slack is how most teams use Luno OS agents today. Connect the **Luno OS Slack App** (`luno connect slack --kind luno`; catalog slug `slackbot` — not a Personal Slack Account user token), bind Slack channels to your agent, and teammates can message it like any coworker. The gateway turns each message into an agent session and posts the reply back as the bot.

See [external channels](https://docs.os.meetluno.ai/learn/agents/external-channels.md) for the three Slack connection kinds, connecting, binding channels, listen modes, and channel sessions.

## Use agents in the web app

Every deployed agent has a chat surface on its page in the web app: open **Agents** in Studio (or the agent in its Space, in the User view), select the agent, and message it directly; the chat dock can talk to it from any page. Each conversation is an agent session — start a new one with **New chat**, and revisit past sessions from the history rail on the right. Sessions started in the app appear in [Runs](https://docs.os.meetluno.ai/learn/logs/agent-runs.md) alongside every other surface. Replies stream live, tool approvals are decided inline, and the composer has mode and model pickers — see [Chat with agents](https://docs.os.meetluno.ai/learn/web-app/agent-chat.md).

This is where teammates who never touch the CLI use what you build. Chatting with a deployed agent is different from [Luno Builder](https://docs.os.meetluno.ai/build-with-ai/platform-agent.md), the built-in builder chat that creates and edits agents rather than running them.

## Use agents from the CLI

The CLI is the most practical way to run an agent while you build and test it. Deploy your project, then prompt the agent against the deployed project:

```bash theme={null}
luno deploy --project <slug>   # or --filter agents/support
luno agents prompt support \
  --message "What is Luno OS?" \
  --wait \
  --timeout 120
```

The `support` value is the agent `slug` from `defineAgent()`. With `--wait`, the response includes the completed session and its messages. Without it, the command returns the queued `sessionId` and `runId` immediately.

`--wait` is bounded and defaults to 120 seconds for agents. Choose another duration with `--timeout <seconds>`. A timeout means the session is still active, not failed. Continue waiting with:

```bash theme={null}
luno agents sessions get support <session-id> --wait --timeout 120
```

When you call an agent from code and need a typed object back, pass an `outputSchema` and read `result.output` — see [structured output](https://docs.os.meetluno.ai/learn/agents/build-agents.md#structured-output).

Continue the same session by passing its ID:

```bash theme={null}
luno agents prompt support \
  --session-id <session-id> \
  --message "Now turn that into a Slack reply" \
  --wait
```

Agent runtime commands run against your deployed cloud project:

```bash theme={null}
luno agents prompt support --message "Prompt the deployed agent" --wait
```

> [!NOTE]
>
> `luno agents list` is platform/org-level and lists agents in the active organization or project. Prompt and session list/get commands run against the resolved project target. Session cancellation is platform-backed today.

List recent sessions for one agent:

```bash theme={null}
luno agents sessions list support
```

Filter while debugging:

```bash theme={null}
luno agents sessions list support --status failed
luno agents sessions list support --source gateway
```

Get details — start lean, then expand:

```bash theme={null}
luno agents sessions get support <session-id> --wait --timeout 120
luno agents sessions get support <session-id> --summary
luno agents sessions get support <session-id> --include messages,trace
```

Use `--include gateway,messages,events,trace` when you need all available session detail. See the [CLI reference](https://docs.os.meetluno.ai/cli.md#agents) for the full command list.

Cancel a running cloud session by ID:

```bash theme={null}
luno agents sessions cancel <session-id>
```

Cancellation is useful when an agent is stuck in a long-running tool call or no longer needs to finish. This command uses the active platform context today, so use it for deployed/cloud sessions.

## Use agents in workflow steps

Agents can be called from workflows and actions with `.prompt()`:

```ts theme={null}
const result = await supportAgent.prompt({
  message: "Draft a reply for this customer thread.",
});
```

When called inside a workflow, the agent prompt is part of the workflow execution and also creates an agent session. Inspect both the workflow run and the agent run when debugging handoff behavior.

## Run agents from triggers

A [trigger](https://docs.os.meetluno.ai/learn/triggers/overview.md) attaches an event source (a schedule, a webhook, or a poll) to an agent, so the agent runs on its own when the source fires instead of waiting for someone to prompt it. Triggers live in `src/triggers/`; a source exposes `.attach()`, where you pass the agent and the `prompt` to run.

```ts src/triggers/morning-check.ts theme={null}
import { defineCronSource } from "@meetluno/luno/trigger";
import support from "../agents/support";

export default defineCronSource({
  slug: "morning-check",
  name: "Morning check",
  description: "Asks support to summarize overnight issues each morning.",
  schedule: "0 9 * * *",
}).attach({
  agent: support,
  prompt: () => "Summarize anything that needs attention this morning.",
});
```

Webhook and poll sources pass their payload to `prompt`, so the agent can act on the event that fired it:

```ts src/triggers/new-inbox.ts theme={null}
}).attach({
  agent: support,
  prompt: (payload) => `Summarize this new inbox item: ${JSON.stringify(payload)}`,
});
```

Each fire starts a new agent session, just like any other surface. Inspect them in **Runs** (filter **Type** to **Agent**) or from the CLI:

```bash theme={null}
luno triggers runs list morning-check --agent support
```

See [triggers](https://docs.os.meetluno.ai/learn/triggers/overview.md) for the full source-and-attach model, payload filters, and transforms.

Agents can also schedule their own runs at runtime instead of waiting for a code trigger. See [ephemeral triggers](https://docs.os.meetluno.ai/learn/agents/build-agents.md#ephemeral-triggers).

## Use agents via API

You can also prompt a deployed agent over HTTP. The route is asynchronous: it enqueues the prompt and returns `202` with a `sessionId` and `runId` to inspect later, rather than waiting for the agent to finish.

```bash theme={null}
curl -X POST https://<your-project>/api/projects/<project-id>/agents/support \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <org-api-key>" \
  -d '{ "message": "Summarize our refund policy" }'
```

Continue an existing session by including its `sessionId` in the body alongside the new `message`; send only the new message, not the prior turns. Only the session's owner (who started it) or a project admin (the project **Admin** role, or an org owner/admin) can continue it, and only if they may use the agent ([access lists](https://docs.os.meetluno.ai/learn/projects/governance.md#access-lists)); anyone else gets `403`. Sessions without an owner, such as Slack or Teams channel conversations, are a project admin's only. Inspect the result later in **History** or with `luno agents sessions get`.

This is mainly useful for wiring agents into your own services. For most internal tooling, Slack and the CLI cover what you need.

## Review agent runs

Every surface that runs an agent creates an agent session you can review later. Open **Runs** (`/history`) in the web app and filter **Type** to **Agent**. The detail panel shows messages, tool calls, metadata, trace data, timing, and errors. The trace has one span per model call (the model that answered, input/output tokens and model time), so you can see where a slow or expensive session spent its time.

When a session is waiting on a [human approval](https://docs.os.meetluno.ai/learn/agents/build-agents.md#human-approval), the chat shows the pending call with **Approve** / **Deny**; from the CLI use `luno agents approvals list|approve|deny`.

From the CLI, use session commands when you want to inspect runs while debugging:

```bash theme={null}
luno agents sessions list support
luno agents sessions get support <session-id> --wait --timeout 120
luno agents sessions get support <session-id> --summary
luno agents sessions get support <session-id> --include messages,events,trace
```

See [agent runs](https://docs.os.meetluno.ai/learn/logs/agent-runs.md) for the full run history view.

## Next steps

> **[Triggers](https://docs.os.meetluno.ai/learn/triggers/overview.md)**
>
> Run agents on a schedule, webhook, or poll.

> **[External channels](https://docs.os.meetluno.ai/learn/agents/external-channels.md)**
>
> Connect Slack and route channel messages to agents.

> **[Agent runs](https://docs.os.meetluno.ai/learn/logs/agent-runs.md)**
>
> Inspect messages, tool calls, errors, and traces.

> **[Deploy a project](https://docs.os.meetluno.ai/learn/projects/deploy-a-project.md)**
>
> Ship agent changes to the platform.


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