# Sessions & projects

> How RavChat organizes agent work into projects and sessions.


Every agent turn runs inside a **project** (a workspace that owns files) and a **session** (one conversation). You never have to create them by hand — RavChat auto-creates whatever a request needs and returns the ids.

## Auto-create

- **No project** bound or named → your key's stable API project is created once and reused. Never a new project per request.
- **No session** named → a fresh session is created for the request.

The ids arrive on every response in `x_ravchat` and the `x-ravchat-*` headers.

## Continuing a session

Pass explicit hints to continue a live session with only your last message (requires `sessions:write`):

```json
"metadata": {"ravchat": {"session_id": "sess_...", "project_id": "..."}}
```

On an affinity hit the agent uses its own memory of the session and ignores resent history — so edit-history workflows should stay stateless. If the hinted session is gone, the turn falls back to a fresh conversation and `x_ravchat.created.session` reports `true`.

## Projects API

OpenAI has no key-plane projects API, so these are RavChat vendor endpoints in OpenAI-style envelopes:

| Endpoint | Behavior |
|---|---|
| `GET /v1/projects` | projects visible to the key |
| `POST /v1/projects` | create (requires `projects:write`; owner-wide keys only) |
| `GET /v1/projects/{id}` | single project |
| `GET/POST /v1/projects/{id}/files` | list / add project files |

See the [API Reference](/api-reference/projects/list-projects) for the interactive playground.
