---
title: Projects & lifecycle
description: Open a project for a user, get an agent, and close the project when finished.
---

[!nav:main](/nav/main.md)

Use `Croche.open(...)` to open a project for your app's user. Pass the project's key, configuration, and registered tool handlers. See the [TypeScript](../sdks/typescript.md) or [React Native](../sdks/react-native.md) option tables.

## Get an agent

After opening a project as `croche`:

```ts
const agent = await croche.agent();
const result = await agent.request({
  id: crypto.randomUUID(),
  text: 'Hello!',
});
```

Use the [agent API](agents.md) for named agents and separate conversations. Each agent has its own conversation and memory.

## Keep users separate

Use the authenticated user's stable ID for the `user` option. Do not trust an unauthenticated client to choose another user's identity. In a backend app, keep each user's storage separate.

## Close when finished

```ts
await croche.close();
```

Close the project when its lifetime in your app ends. For a complete example with cleanup, see the [TypeScript guide](../sdks/typescript.md).
