# Create an agent

Create a managed agent from the Fleet page, give it an identity and first instructions, and start it.

## Prerequisites

- The **admin** or **owner** role, or a custom role that grants agent creation.
- At least one LLM provider, if the agent will call a model. See [LLM providers](/docs/ai-gateway/providers).

## Steps

1. Open **Agents › All agents** and choose **+ Create agent** (or go to `/agents/create`).
2. Choose **Managed by Liyagent**. The type is fixed once the agent is created.
3. Fill in the form. Managed agents have six sections, and two optional ones under collapsed headings:

   | Section | Notes |
   | --- | --- |
   | 01 Identity | **Name** and **Description**. The **Agent id** is made from the name (lowercase letters, digits and hyphens). A taken id gets a number. It is the agent's permanent key: budgets, policies and the audit log address it, and it cannot be changed later. |
   | 02 Model | The provider and model it reasons with, from this instance's connected providers, or the instance default backend. |
   | 03 Instructions | Its system prompt, in Markdown. Start from a template or write your own, and edit it later on the agent's **Settings** tab. |
   | 04 Tools | The MCP servers it may call. You can attach more later. |
   | 05 Access | Who may use it: the access policy created with it. |
   | 06 Tags | Under **Advanced**: `key=value`, comma-separated. Usage and cost reports can be broken down by tag. An instance can require some tags. |
   | 07 Limits | Under **Limits**, optional. The **Context window** (the input tokens one step may send, 1,024 to 2,000,000; blank is the smaller of the model's window and 32,000), the **Step cap** (model calls per request) and the **Run limits** (wall-clock deadline, tool calls, delegations, identical tool calls, token and USD ceilings per run). Blank keeps the default. |
   | 08 Sub-agents | Under **Sub-agents**, optional. Helpers the agent delegates to, each with a description (what the agent reads to decide to use it), instructions, the context it is handed, a model and provider override, its MCP servers, and its own **Context window**, **Reply cap**, **Step cap** and **Run limits**, none above the parent's. A registered agent can be added as a sub-agent too: it then runs as itself. |

4. Choose **Create agent**. One submit creates the agent, its model binding, its runtime (MCP servers, limits and sub-agents) and its access policy. If a step fails, the agent is deleted again so nothing is left half-made.
5. The agent opens on its own page with a **Set up** checklist above its tabs: context window reviewed, guardrails applied, connected to a channel (Teams, Google Chat, Slack, email or web chat; people who may chat with it already find it in the workspace), sub-agents added (optional) and tested in the Playground. An item clears as soon as the data says so; **Dismiss** hides the card in your browser. Start the agent from there, and refine it on **Settings** (see [Instructions and model](/docs/agents/instructions-model)).

> [!NOTE]
> Choose **Self-managed** instead when the agent's code runs on your infrastructure. It then gets a credential and calls the gateway. See [Set up your agent](/docs/get-started/set-up-your-agent).

## With the API

```bash
curl -X PUT https://<host>/api/gateway/agents/hr-helper \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"label":"HR helper","about":"Answers HR policy questions",
       "runtime":"managed","prompt":"You answer questions about the HR handbook.",
       "tags":["team=hr"]}'
```

`tags` is a list of `key=value` strings. Bind its model with `PUT /api/agents/hr-helper` and attach tools with `PUT /api/agents/hr-helper/runtime`. Other agent routes: `GET /api/gateway/agents`, `GET`, `PATCH` and `DELETE /api/gateway/agents/{agent_id}`.

## Next steps

- [Instructions and model](/docs/agents/instructions-model)
- [Sub-agents](/docs/agents/sub-agents)
- [Playground and evals](/docs/agents/playground-evals)
