These steps create an agent, start a session from it, wait for it to finish, and read its output.

## Core concepts

| Concept | Meaning |
| --- | --- |
| [Agent](/docs/agents) | An agent saves a prompt, an environment, permissions, and a budget. |
| [Environment](/docs/environments) | An environment is the repositories, setup scripts, environment variables, and machine size a session starts with. |
| [Session](/docs/sessions) | A session is a conversation with [Claude Code or Codex](/docs/models) in its own cloud environment. |

## Before you begin

<span id="get-started" />

### Install on GitHub

[Get Started](https://app.ellipsis.dev)

### Install the CLI

```bash
curl -fsSL https://ellipsis.dev/install.sh | sh
```

### Sign in

Sign in with device auth. The CLI opens your browser to approve the login:

```bash
el auth login
```

For CI, the SDKs, and curl, export an API key from **API > API keys** in the dashboard:

```bash
export ELLIPSIS_API_TOKEN="ellipsis_key_..."
```

### Install the SDK

```bash title="Python"
pip install ellipsis-dev
```

```bash title="TypeScript"
npm install @ellipsis-dev/sdk
```

## Create your first session

### Create an agent

```yaml title="classify-change.yaml"
ellipsis:
  kind: agent
  name: classify-change

input:
  json_schema:
    type: object
    properties:
      description:
        type: string
    required: [description]
    additionalProperties: false

session:
  claude_code:
    prompt: |
      Classify the requested change as bugfix, feature, or maintenance.
      Explain the classification in one sentence.

      The change is {{description}}
    model: claude-opus-5-5
  output:
    json_schema:
      type: object
      properties:
        category:
          type: string
          enum: [bugfix, feature, maintenance]
        reason:
          type: string
      required: [category, reason]
      additionalProperties: false
  budget:
    session: 1
```

Start it with `{"input":{"description":"Reject expired reset tokens"}}` instead of a prompt. The validated result is `output.result` on the session once the message is answered.

```bash
el agent create -f classify-change.yaml
```

[`POST /v1/agents`](/docs/api/agents/post-agents) creates an agent without a repository file. Send the same fields as JSON under `agent`.

### Start an agent session

Start the `classify-change` agent:

```bash title="CLI"
el agent start classify-change --input '{"description": "Reject expired reset tokens"}'
```

```python
import os

from ellipsis import Ellipsis

client = Ellipsis(api_key=os.environ["ELLIPSIS_API_TOKEN"])
change = {"description": "Reject expired reset tokens"}
response = client.agents.start("classify-change", input=change)
print(response.session.id)
```

```typescript
import { Ellipsis } from '@ellipsis-dev/sdk';

const apiKey = process.env.ELLIPSIS_API_TOKEN!;
const client = new Ellipsis({ apiKey });
const input = { description: 'Reject expired reset tokens' };
const { session } = await client.agents.start('classify-change', { input });
console.log(session.id);
```

```bash title="cURL"
curl https://api.ellipsis.dev/v1/agents/classify-change/sessions -H "Authorization: Bearer $ELLIPSIS_API_TOKEN" -H "Content-Type: application/json" -d '{"input": {"description": "Reject expired reset tokens"}}'
```

[Typed input and output](/docs/agents/schema#typed-input-and-output) defines it. An agent with no input schema takes `prompt` instead of `input`.

### Wait for it to finish

```bash title="CLI"
el session get <session-id> --watch
```

```python
handle = client.sessions.handle("your-session-id")
ended = handle.wait()
print(ended.status)
```

```typescript
const handle = await client.sessions.handle('your-session-id');
const ended = await handle.wait();
console.log(ended?.status);
```

```bash title="cURL"
# Repeat until session.status is idle or closed
curl https://api.ellipsis.dev/v1/sessions/your-session-id -H "Authorization: Bearer $ELLIPSIS_API_TOKEN"
```

`wait` and `--watch` return when the session is `idle` or `closed`. `wait` returns how the message ended, one of `completed`, `failed`, `stopped`, or `cancelled`. `--watch` exits `0` only when the session has no `error`.

### Read the output

```python
print(client.sessions.get("your-session-id").session.output.result)
```

```typescript
console.log((await client.sessions.get('your-session-id')).session.output?.result);
```

```bash title="cURL"
curl https://api.ellipsis.dev/v1/sessions/your-session-id -H "Authorization: Bearer $ELLIPSIS_API_TOKEN" | jq .session.output.result
```

It matches the agent's `output.json_schema` and is `null` until the agent submits it.

```json
{
  "category": "bugfix",
  "reason": "Rejecting expired reset tokens closes a validation gap."
}
```

## What's happening

When you start the agent, these happen in order.

1. Ellipsis checks `input` against the agent's `input.json_schema`, returning `422` when it doesn't match.
2. `message` renders as `Classify this change: Reject expired reset tokens`.
3. A new session starts with the agent's prompt, model, and budget.
4. Claude Code answers the message in its own cloud environment.
5. The validated result is saved as `output.result` on the session.
6. The session's `status` becomes `idle` and it stays open for follow-ups.

## Errors and retries

- Errors return `{"error": {"code": "...", "message": "..."}}`. Branch on `code`, not `message`.
- Retry `429` after `Retry-After`, and `5xx` with backoff.
- A start that times out can still succeed. Send the same `idempotency_key` when you retry it, and you get back the session the first request started. Keys are kept for 90 days.

## Pagination

- Paginated routes take `limit` and `cursor`.
- Pass `next_cursor` until `has_more` is `false`.
- SDK iterators fetch every page.

## Next steps
  - [Agents](/docs/agents): Save a task and run it on a schedule or event
  - [Environments](/docs/environments): Install your tools and connect MCP servers
  - [Python SDK](/docs/api/python-sdk): Handles, streaming, and typed errors
  - [TypeScript SDK](/docs/api/typescript-sdk): Handles, streaming, and typed errors
  - [Session events](/docs/api/session-events): Every event a session emits
  - [Authentication](/docs/api/authentication): Create and use an API key
