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

# Deploy your project

> Deploy to staging on Flow, check the release and promote it to production.

Deploy the starter to Flow, test the staged version and promote it without rebuilding. To run
on your own infrastructure instead, follow the [self-hosting guide](https://flow.engineer/docs/self-hosting.md).

## Deploy on Flow

**1. Set up the project**

From the agent's folder, sign in and set up its keys if you have not already:

```sh Terminal
npx @flow-engineer/flow login
npx @flow-engineer/flow setup
```

The deploy command uses `FLOW_FRAMEWORK_CLOUD_KEY`. The starter's `buildAgent` already accepts
`options.host` and passes it to `createAgent`.

**2. Deploy to staging**

```sh Terminal
npx @flow-engineer/flow deploy
npx @flow-engineer/flow deploy status
```

`deploy` sends the project's `.env` values as secrets, builds the agent and follows the
deployment to live. The default environment is staging.

**Check it worked:** `deploy status` shows the live version and the URL the host reports.
Exercise a request, then inspect its log lines:

```sh Terminal
npx @flow-engineer/flow logs --since 15m
```

**3. Promote the checked version**

After checking staging, promote its live version:

```sh Terminal
npx @flow-engineer/flow deploy promote
```

Promotion uses the staged version without a new build. Production has its own secrets.

The starter exports an MCP server in `src/mcp.ts` for the host to serve beside the agent.
Connect its public URL through the [MCP setup](https://flow.engineer/docs/framework/mcp.md).

> **The buildAgent contract and secrets**
>
> For a custom entry point, accept the host options and pass them as `host: options.host` to
> `createAgent`. Do not spread them into the agent options. Production expects the host's durable
> store instead of an agent's own database.
>
> `deploy` needs `package.json`, `package-lock.json` and `src/agent.ts`. It uploads the project
> without `node_modules`, Git data or environment files, then sends eligible environment values
> separately as secrets. Use `--no-secrets` to skip sending them.
>
> The [deployment reference](https://flow.engineer/docs/agents.md#host-it) covers secret updates, flags, JSON output and exit codes.

> **[Host it yourself](https://flow.engineer/docs/self-hosting.md)**
>
> Run MCP and messaging on your own Node infrastructure.

> **[Inspect traces](https://flow.engineer/docs/traces.md)**
>
> See model calls, tool calls and conversation events.
