---
title: "Run an AI agent task"
method: POST
path: "/v1/agent/run"
tags: ["Products"]
---

# Run an AI agent task

`POST /v1/agent/run`

## Request

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

Give the Algenta Agent Engine a task. It breaks it down, uses tools (search, simulate, optimize, calculate), and returns a structured result.

Direct replacement for LangChain and LangGraph agent pipelines.

## Request body

- AgentRunRequest: Give Algenta a task. It plans, executes tools, and returns a structured result. Drop-in replacement for LangChain / LangGraph agent workflows.
  - `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

## Response `200`

Successful Response

- AgentRunResponse
  - `run_id` string, required
  - `status` string, required
  - `result` union, required
    - string
    - object
  - `steps` AgentStep[], required
    - `step` integer, required
    - `action` string, required
    - `tool` string, nullable
    - `result` string, nullable
    - `status` string
  - `tools_used` string[], required
  - `latency_ms` number, required

## 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)
