Levain LabsLevain Labs
API ReferenceAgents

Create Version

Create a new version of an agent.

Behaviour:

  • No versions exist yet → provision a fresh Gitea repo with the bootstrap template and create v1.
  • Versions exist, no parent_version in body → branch v{N} off the latest version's ref.
  • parent_version specified → branch v{N} off the named version's ref (the fork case).
POST
/api/v1/agents/{agent_id}/versions

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Path Parameters

agent_id*string

Header Parameters

X-API-Key?|

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/string/versions" \  -H "Content-Type: application/json" \  -d '{}'
{
  "id": "string",
  "agent_id": "string",
  "version": 0,
  "description": "string",
  "status": "string",
  "created_by": "string",
  "git_repo": "string",
  "git_ref": "string",
  "parent_version": 0,
  "created_at": "string",
  "updated_at": "string"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}