Skip to Content
Levain LabsLevain Labs
API ReferenceSchedules

Create Schedule

Create a cron schedule for an agent.

Create a cron schedule for an agent.

agent_id is the agent's id or slug. The schedule fires its first run at the next time matching cron_expr after this call returns. Set run_as to have its runs act for you, with your person memory and rules; the person a schedule runs as is shown on it and set only at creation. Use DELETE /api/v1/schedules/{id} to remove a schedule, or PATCH /api/v1/schedules/{id} with enabled=false to pause it without losing its configuration.

POST
/api/v1/agents/{agent_id}/schedules

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Path Parameters

agent_id*Agent Id

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/string/schedules" \  -H "Content-Type: application/json" \  -d '{    "cron_expr": "string"  }'
{
  "id": "string",
  "agent_id": "string",
  "agent_version_id": "string",
  "cron_expr": "string",
  "timezone": "string",
  "prompt": "string",
  "initial_state": {},
  "enabled": true,
  "paused_reason": "string",
  "resume_at": "string",
  "skip_if_active_within_minutes": 0,
  "run_as_user": {
    "id": "string",
    "name": "string",
    "email": "string"
  },
  "next_fire_at": "string",
  "last_fired_at": "string",
  "last_run_id": "string",
  "created_at": "string"
}