Levain LabsLevain Labs
API ReferenceAgents

Create Agent

Create an agent.

Without prompt the agent is created with no versions; callers follow up with POST /{id}/versions and /{id}/versions/{version}/build to produce a first build.

With prompt the endpoint also creates v1 and kicks off the first build in a single call. If any step fails, partial state is rolled back so a retry starts clean.

POST
/api/v1/agents/

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Header Parameters

X-API-Key?string|null

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://api.levainlabs.com/api/v1/agents/" \  -H "Content-Type: application/json" \  -d '{}'
{
  "agent": {
    "id": "string",
    "name": "string",
    "slug": "string",
    "description": "string",
    "status": "string",
    "config": {
      "max_budget": 1,
      "timeout_minutes": 1,
      "notify_on_run": true
    },
    "created_at": "string",
    "updated_at": "string",
    "draft_version": 0
  },
  "version": 0,
  "run_id": "string",
  "session_id": "string"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}