Skip to content
Croche / Developer docs

Projects & lifecycle

Read as Markdown

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 or React Native option tables.

After opening a project as croche:

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

Use the agent API for named agents and separate conversations. Each agent has its own conversation and memory.

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.

await croche.close();

Close the project when its lifetime in your app ends. For a complete example with cleanup, see the TypeScript guide.