---
title: ".start()"
description: "Seal configuration, initialize resources, and start the agent runtime."
---

> Documentation Index
> Fetch the complete documentation index at: https://xsaf.ilha.build/llms.txt
> Use this file to discover all available pages before exploring further.

# .start()

## Signature

```ts
agent.start(): Promise<XsafAgent>
```

## Usage

```ts
import { agent } from "@xsaf/agent";

const bot = agent(config).memory(memory).channel(channel);
await bot.start();
```

`.start()` seals the agent, initializes configured resources, and returns the running agent. Concurrent calls coalesce into the same startup operation.

## Lifecycle behavior

Resources start in declaration order. If a resource fails, XSAF closes everything that already started before rejecting. Registration order matters when one capability depends on another—for example, call [`.mcp()`](/xsaf/mcp) before [`.serve()`](/xsaf/serve) when remotely discovered tools must be included in the served snapshot.

A started agent forwards [`.invoke()`](/xsaf/invoke), [`.ask()`](/xsaf/ask), and [`.fetch()`](/xsaf/fetch) to its runtime. Calling those methods before startup throws.

Always pair startup with [`.stop()`](/xsaf/stop), normally in a `finally` block or process-shutdown handler.

Source: https://xsaf.ilha.build/xsaf/start/index.mdx
