---
title: "Create an agent"
method: POST
path: "/agents"
---

# Create an agent

`POST /agents`

Create an agent in the environment. Only `name` and `instructions` are required — `cadence` defaults to `manual`, which runs only when triggered via `POST /agents/{id}/runs`. Scheduled cadences require their time fields: `minute` for hourly, plus `hour` for daily/weekdays, plus `day_of_week` for weekly.

## Request body

- object
  - `name` string, required — Unique within the environment
  - `description` string
  - `instructions` string, required — The standing prompt every run executes
  - `model` string — Explicit model override. Omit to follow the platform default.
  - `cadence` 'manual' | 'hourly' | 'daily' | 'weekdays' | 'weekly'
  - `hour` integer
  - `minute` integer
  - `day_of_week` integer — 0 = Sunday
  - `timezone` string — IANA timezone the schedule is evaluated in
  - `active` boolean
  - `handles_file_drops` boolean — At most one active agent per environment can have this enabled
  - `delivery_enabled` boolean
  - `delivery_recipients` string[]
  - `delivery_file_pattern` string
  - `mentions` object[]
    - `type` 'reconciliation' | 'data_stream' | 'user', required
    - `id` string, required
    - `label` string, required

## Response `201`

Agent created

- Agent — An agent: standing instructions executed in an isolated sandbox with access to the environment's data, on a schedule or on demand. The same objects the app's Agents page manages.
  - `id` string, uuid
  - `name` string, required — Unique within the environment
  - `description` string, nullable
  - `instructions` string, required — The standing prompt every run executes
  - `mentions` object[] — Reconciliations, data streams, and users whose context is resolved into every run's prompt
    - `type` 'reconciliation' | 'data_stream' | 'user', required
    - `id` string, required
    - `label` string, required
  - `model` string — The model the agent runs on — resolved to the platform default when not set explicitly
  - `cadence` 'manual' | 'hourly' | 'daily' | 'weekdays' | 'weekly' — `manual` agents only run when triggered (POST /agents/{id}/runs)
  - `hour` integer, nullable — Required for daily, weekdays, and weekly cadences
  - `minute` integer, nullable — Required for every cadence except manual
  - `day_of_week` integer, nullable — 0 = Sunday. Required for weekly cadence
  - `timezone` string — IANA timezone the schedule is evaluated in
  - `active` boolean — Inactive agents are never scheduled but can still be run on demand
  - `handles_file_drops` boolean — Whether this agent processes files dropped in the app. At most one active agent per environment can have this enabled.
  - `delivery_enabled` boolean — Email output files matching delivery_file_pattern to delivery_recipients after each completed run
  - `delivery_recipients` string[]
  - `delivery_file_pattern` string — Case-insensitive glob selecting which output files are delivered
  - `input_files` AgentFile[]
    - `id` string, uuid
    - `filename` string
    - `byte_size` integer
    - `content_type` string
    - `created_at` string, date-time
    - `url` string — Signed download path, relative to the API host
  - `next_run_at` string, date-time, nullable
  - `last_run_at` string, date-time, nullable
  - `created_at` string, date-time
  - `updated_at` string, date-time

## Other responses

- `401` — Unauthorized
- `403` — Forbidden — agent management requires a standard API key
- `422` — Validation error

---

[API](https://skmtc.dev/endclose/apis/end-close-api.md) · [All operations](https://skmtc.dev/endclose/apis/end-close-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/endclose/end-close-api/revisions/2e572738191a/schema)
