---
title: "Discover and prepare the next input for a trusted conversation worker"
method: POST
path: "/api/v1/agent/persistent/scheduler/prepare_next_task"
tags: ["agent"]
---

# Discover and prepare the next input for a trusted conversation worker

`POST /api/v1/agent/persistent/scheduler/prepare_next_task`

## Request

- Base URL: `https://composal.com` (the document declares no server; this is the origin it was published from)
- URL: `https://composal.com/api/v1/agent/persistent/scheduler/prepare_next_task`
- Auth: HTTP bearer

Dedicated scheduler transport only. Rails selects the current owner and ordered input and performs canonical task admission. Returns only locators, preparation and a short-lived input-scoped attachment token; never private message content or model/tool authority. Retry reuses the original task/workflow identity. Never save the response in Temporal history.

## Request body

- object
  - `organization_id` string, required
  - `agent_id` string, required
  - `conversation_id` string, required

## Response `200`

Prepared exact input, or null input/token/preparation when no input is currently eligible.

- PersistentAgentSchedulerPreparedInput
  - `organization_id` string, required
  - `agent_id` string, required
  - `conversation_id` string, required
  - `input_id` string, nullable, required
  - `dispatch_token` string, nullable, required
  - `preparation` PersistentAgentTaskDispatchPreparation, required
    - `task_id` string, required
    - `workflow_id` string, required
    - `start_allowed` boolean, required
    - `first_execution_run_id` string, uuid, nullable, required
    - `wake_required` boolean, required

## Other responses

- `401`: Invalid dedicated scheduler transport credential
- `403`: Current controlling authority is unavailable
- `404`: No matching persisted/canonical conversation
- `409`: Lifecycle or source index requires reconciliation
- `422`: Invalid or oversized JSON request
- `502`: Bad gateway
- `503`: Canonical state is temporarily unavailable; retry without inventing another task/workflow identity

---

[API](https://skmtc.dev/composal/apis/vex-api.md) - [All operations](https://skmtc.dev/composal/apis/vex-api/llms.txt) - [OpenAPI document](https://skmtc.dev/composal/apis/vex-api/revisions/74298a24e040?raw)
