---
title: "Create a persisted agent run"
method: POST
path: "/v1/agent/runs"
tags: ["Agent Runtime"]
---

# Create a persisted agent run

`POST /v1/agent/runs`

## Request

- Base URL: `https://api.algenta.ai`
- URL: `https://api.algenta.ai/v1/agent/runs`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-Key`

Creates a deterministic persisted agent run. The run can complete immediately, pause before execution, or wait for approval before executing its selected tool.

## Request body

- AgentRunCreateRequest: Create a persisted agent run lifecycle resource.
  - `task` string, required: What should the agent do?
  - `context` object, nullable: Additional context or data
  - `tools` string[], nullable: Tools to make available: search, simulate, optimize, calculate, summarize
  - `max_steps` integer: Maximum execution steps
  - `output_format` string: Output format: text, json, markdown
  - `approval_mode` 'auto' | 'manual': Execution mode: auto executes immediately, manual waits for approval.
  - `start_paused` boolean: If true, persist the run in paused state until /resume is called.

## Response `200`

Successful Response

- AgentRunResource
  - `run_id` string, required
  - `status` 'running' | 'paused' | 'requires_approval' | 'completed' | 'cancelled', required
  - `task` string, required
  - `output_format` string, required
  - `approval_mode` 'auto' | 'manual', required
  - `pending_action` 'resume' | 'approve', nullable
  - `selected_tool` string, nullable
  - `result` union
    - string
    - object
  - `tools_available` string[]
  - `tools_used` string[]
  - `steps` AgentStep[]
    - `step` integer, required
    - `action` string, required
    - `tool` string, nullable
    - `result` string, nullable
    - `status` string
  - `request_hash` string, nullable
  - `decision_hash` string, nullable
  - `policy_snapshot_id` string, nullable
  - `schema_snapshot_id` string, nullable
  - `manifest_version` string, nullable
  - `replayable` boolean
  - `artifact_refs` string[]
  - `latest_checkpoint_id` string, nullable
  - `checkpoint_count` integer
  - `source_run_id` string, nullable
  - `source_checkpoint_id` string, nullable
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required
  - `latency_ms` number, nullable

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/codna/apis/algenta-api.md) · [All operations](https://skmtc.dev/codna/apis/algenta-api/llms.txt) · [OpenAPI document](https://skmtc.dev/codna/apis/algenta-api/revisions/35d30f84a5df?raw)
