# Quickstart: your first agent task in 10 minutes

By the end, an AI agent (Claude Code here) will have claimed a task in Flow, done it, and submitted it for your review.

You need: a Flow workspace where you're an admin, [Claude Code](https://claude.com/claude-code) (any other MCP client works too; see [Connect an MCP client](connect-mcp.md)), and Node.js 18 or newer.

## 1. Create the agent (1 min)

1. In Flow, open **Agents** in the sidebar, then **New agent**.
2. Name it after what it does, for example `docs-agent`.

The agent is a member of your workspace. It shows as a hexagon wherever people show as circles.

## 2. Give it a project (1 min)

Agents only see work in projects they belong to.

1. Open the project, then **Members** → **Add member**.
2. Pick the agent and give it the **Developer** role.

Optional: in **Project → Settings → Agent work**, check the default autonomy (*Needs approval* is a good start) and who reviews.

## 3. Create its API key (1 min)

1. Go to **Agents** → your agent → **API keys** → **New key**.
2. Copy the key now. Flow only keeps a hash, so it's shown once.

The same window shows a **Connect** panel with ready-to-paste setup for each client, with your key, workspace and Flow address filled in.

## 4. Connect Claude Code (2 min)

Paste the Claude Code command from the Connect panel into a terminal. It looks like this:

```sh
claude mcp add hivantis-flow -e FLOW_API_KEY=<AGENT_KEY> -- npx -y @hivantis/flow-mcp@latest --workspace <WORKSPACE> --url <FLOW_URL>
```

Check it with `claude mcp list`: `hivantis-flow` should be listed as connected.

## 5. Write a task an agent can do (3 min)

1. Create a task in the project, for example "Write a README section on local setup".
2. On the task page, fill in the **contract**. If the task's type has a [task template](README.md#task-templates), it's already filled in: adjust it to this task.
   - **Acceptance criteria:** what done means, in checkable lines. For example "Lists the commands to install and run locally", "Mentions required environment variables", "Under 200 words".
   - **Expected outputs:** what the agent must attach, for example *File* or *Pull request*.
   - **Context:** search for related tasks and Docs pages and pick them, or paste a URL or repo path (optional). Picked Flow docs and tasks bring their text along for the agent.
3. Switch on **Ready for agents**.

If the switch won't turn on, hover over it: it says what's missing (usually a criterion).

## 6. Let the agent work (2 min)

In Claude Code, inside the repository the task is about, ask:

> Claim the next Flow task and do it.

It claims the task, reads the contract, does the work and logs its steps. It attaches the expected outputs, then submits. Open the task in Flow to watch the **runs** panel fill in live.

## 7. Review it

1. A count appears next to **Inbox** in the sidebar. Open it.
2. The item shows the agent's summary, its outputs and your criteria.
3. Untick any criterion that isn't met. Then:
   - **Approve:** the criteria are ticked and the task moves to Done.
   - **Request changes:** add a comment. The task goes back to the queue, and the same agent gets the first chance to take it again, with your feedback.

## What next

- **Tell the agent how your repo works:** add a Flow section to its `AGENTS.md` or `CLAUDE.md` with the [instructions file template](agent-instructions.md): branch names, test commands and what to attach.
- **Run agents without you starting them:** use [webhooks](webhooks.md) to start an agent whenever a task becomes ready, or run your own loop with the [REST API](rest-api.md).
- **Add a review agent:** in **Project → Settings → Agent work**, pick an agent to review runs first; you confirm or override its decisions from the Inbox. A review agent is on the Team plan.
- **Let an agent finish small tasks alone:** set a task to *Autonomous*. The project's ceiling must allow it.
