# Run an agent per customer task

Returns: A typed answer, by webhook. Starts: from your code.

Your backend starts one session per customer request with an org key, and Rush posts the result to your webhook when the turn ends.

## Best for

- Products that run an agent for each customer request
- Work with no repository: research, drafting, analysis

## Uses

- An org API key
- A webhook endpoint on your server

## The request

`POST /o/{org}/sessions`

```json
{
  "harness": "claude",
  "input": "Draft a reply to this support ticket from the attached thread. Keep it under 150 words."
}
```

## While it works

Live stream events (`GET /o/{org}/sessions/{session}/events`):

- `thinking`: The customer asked about a refund window.
- `message`: Drafted a 120-word reply.
- `result`: turn ended

## What comes back

- `type`: run.completed
- `data.status`: completed
- `data.result`: Thanks for reaching out. Your order is within the 30-day window…
- `data.total_cost_usd`: 0.06

## Steps

1. **Create a key.** An org admin creates a key under Settings, API keys. Store the `rk_live_…` secret on your server as `RUSH_API_KEY`.
2. **Give the key a webhook.** Set a public `https` endpoint on the key. The response carries the `whsec_…` signing secret once.
3. **Start one session per task.** `POST /o/{org}/sessions` with `harness` and `input`. Without a repository it runs in a sandbox of its own, with a computer and a browser.
4. **Verify and store the result.** Each finished turn posts `run.completed`, `run.failed` or `run.cancelled`, signed per Standard Webhooks. Check the signature, then store `data.result`.

Field names are the API's; the values are an example.
