BAMF.ai·
understanding agent sessions
# understanding agent sessions
agent sessions are a game-changer for handling long-running AI workflows. they let you track everything from prompts to approval states, giving you complete visibility.
why is this crucial? a solid agent session ensures you start with read access, preview upcoming posts, suggest precise changes, and document approvals before making any modifications. it's about being proactive, not reactive.
## endpoints
let's dive into the nitty-gritty. you have two main endpoints:
1. GET `/v1/agent-sessions`: this pulls a list of agent sessions for a specific creator space. make sure you include your
Authorization header with a valid API key and specify the creator_id as a query parameter.
2. POST `/v1/agent-sessions`: this lets you create a new agent session record. you'll need your Authorization header and an Idempotency-Key to ensure unique requests. the request body should include the creator_id, a client name (like Codex), and a concise summary of the session.
here’s a quick look at the usage:
### get example
```bash
curl "https://api.bamf.ai/v1/agent-sessions?creator_id=creator_123" \
-H "Authorization: Bearer $BAMF_API_KEY"
```
### post example
```bash
curl "https://api.bamf.ai/v1/agent-sessions" \
-X POST \
-H "Authorization: Bearer $BAMF_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: request-001" \
-d '{"creator_id": "creator_123", "client": "client_value", "summary": "summary_value"}'
```
remember, agent sessions are about making your workflows smoother and more manageable. get them right, and you’ll reduce headaches down the line.
originally from [BAMF.ai](https://bamf.ai/docs/api/agent-sessions).