An agent saves a prompt, an environment, permissions, and a budget. Each start is a new session. A trigger starts it automatically.

## Define an agent

```yaml title=".ellipsis/agents/test-repair.yaml"
ellipsis:
  kind: agent
  name: test-repair

session:
  claude_code:
    prompt: |
      Run the tests in api-repo. Fix one failing test without
      weakening its assertions. Run the affected tests again
      and open a pull request with the change and test results.
    model: claude-opus-5-5
  environment:
    repositories:
      - name: api-repo
  permissions:
    github:
      - read_only
      - allow: [contents.push, pull_requests.create]
        repository: api-repo
  budget:
    session: 5
```

This agent fixes one failing test and opens a pull request. It has no trigger, so it runs only when you start it.

## Deploy from git

Commit a `.yaml` or `.yml` file with `ellipsis.kind: agent` anywhere under `.ellipsis/` on the default branch. It appears on the dashboard's **Agents** page. Your organization can also keep these files in a repository named `.ellipsis`.

If an update is invalid, the last valid version keeps running and the agent's page shows the error. Deleting the file disables the agent.

## Create through the API

`POST /v1/agents` creates an agent without a repository file. Send the same fields as JSON under `agent`.

Each agent is edited in one place: its git file or the API. Use `link` to move an API-created agent into git, or `unlink` to edit a git-managed one through the API.

## Start an agent session

Choose **Run** on its dashboard page, or start it through the API:

```bash
curl https://api.ellipsis.dev/v1/agents/test-repair/sessions -H "Authorization: Bearer $ELLIPSIS_API_TOKEN" -H "Content-Type: application/json" -d '{}'
```

It starts as written, and its session stays open for follow-ups. If it declares `input`, send `input` in the body. To change settings for one session, see [Override settings for a session](/docs/agents#override-settings-for-a-session).

## Override settings for a session

An agent session's request body takes the fields of [Start a session](/docs/api/sessions/post-sessions) plus `input`, all optional, and is merged into the agent's `session` settings as a JSON merge patch. An object merges key by key, and any other value, a list included, replaces the agent's. A field you leave out keeps the agent's value, and `null` removes it so its default applies. An `environment` object is merged into the agent's [environment](/docs/environments), a saved one included, and an environment name replaces it. `output.json_schema` is replaced whole, and naming the other harness replaces the agent's harness.

This agent sets a model, prompt, environment, budget, and metadata:

```yaml title=".ellipsis/agents/repo-summary.yaml"
ellipsis:
  kind: agent
  name: repo-summary

session:
  claude_code:
    model: claude-opus-5-5
    prompt: Summarize api-repo.
  environment: api-environment
  budget:
    session: 2
    day: 10
  metadata:
    labels: [nightly]
    annotations:
      team: platform
```

Started with an empty body, `repo-summary` runs Claude Opus 5.5 in `api-environment` with its saved prompt, stops at $2, and gives the session the label `nightly` and the annotation `team: platform`. The `day` limit caps the agent's total spend at $10 over the last day, and the session stays open for follow-ups.

Replace the prompt for one session; the model, environment, budget, and metadata stay as the file sets them:

```json
{
  "claude_code": {
    "prompt": "Focus on the tests."
  }
}
```

Set the cap for one session to $5; the `day` limit still applies. A request's `budget` takes only `session`, and `day`, `week`, or `month` returns 422:

```json
{
  "budget": {
    "session": 5
  }
}
```

Labels you send replace the agent's, so this session gets only the label `urgent`. Annotations merge, so it gets `team: platform` and `ticket: ENG-42`.

```json
{
  "metadata": {
    "labels": ["urgent"],
    "annotations": {
      "ticket": "ENG-42"
    }
  }
}
```

Remove one of the agent's annotations with `null`. The session gets only `ticket: ENG-42`.

```json
{
  "metadata": {
    "annotations": {
      "team": null,
      "ticket": "ENG-42"
    }
  }
}
```

Start in other repositories by sending a whole environment; `api-environment` is not used, and nothing is merged into it:

```json
{
  "environment": {
    "repositories": [
      {
        "name": "api-repo"
      },
      {
        "name": "web-repo"
      }
    ]
  }
}
```

Scheduled and event-triggered sessions use the same settings, so they stay open for follow-ups too, and anyone with write access to sessions can message a scheduled session because it has no owner. Set `conversation.interactive` to `false`, in the file or in a request body, to run once:

```yaml fragment
session:
  conversation:
    interactive: false
```

## Add a trigger

<span id="triggers" />

```yaml fragment
trigger:
  type: cron
  schedule: '0 9 * * 1'
```

This runs every Monday at 09:00 UTC. An agent has at most one trigger. See [Triggers](/docs/agents/triggers) for schedules and events, or the [Agent schema reference](/docs/agents/schema) for complete examples.

## Slack, GitHub, Linear, and Sentry agents

<span id="handlers" />

A `kind: slack`, `github`, `linear`, or `sentry` agent answers `@ellipsis` mentions in [GitHub](/docs/integrations/github), [Slack](/docs/integrations/slack), and [Linear](/docs/integrations/linear), and investigates [Sentry](/docs/integrations/sentry) alerts. An account has one per service. Define it in a file (`github.yaml`, `slack.yaml`, `linear.yaml`, `sentry.yaml`) at the root of your organization's `.ellipsis` repository, or create it through the API. Its `session` block works like an agent's, including budgets. When Slack, GitHub, or Linear is connected and you haven't defined one, Ellipsis provides one that you can't change.

These agents are on the **Agents** page and in `GET /v1/agents`, each with its `kind`.
