Stream one draft turn
Run one draft turn and stream it as server-sent events (data: <json>). Events: turn (first, {"id"}: the id POST /api/drafter/turns/<id>/cancel stops, the request's turn_id when it sent a valid one; absent when the server can't stop turns), status, read (what a read tool showed the model, {"kind": "questions", "items"}), message, questions, proposal, error, and end (always last). Refusals (disabled, no_model, rate_limited, quota, bad_request) arrive as an error event in a 200 stream; a bad_request carries reason: history (the conversation is refused: start a new one), too_long (the prompt is over the read cap, with limit), empty (the message is empty once cleaned) or invalid. Nothing is saved.
Not available to personal access tokens; call it from a signed-in session.
bearerAuthorizationBearer <token>A session token or a personal access token. Leave it empty when the instance runs without authentication (AUTH_TYPE unset).
application/json- body
context?The recipe's screen state: the agent form's current values (agent), the prompt being written or improved (prompt), or {agent_id} (topics)
messages*array<>The conversation so far, oldest first: {role: user | assistant, content}. An assistant message is the JSON of an earlier questions or proposal event. Ends with a user message.
recipe*stringWhat is drafted: agent (the agent form), prompt (a prompt), topics (Insights topics)
turn_id?stringThe id the client picks for this turn (32 lowercase hex characters), so it can stop the turn before the turn event arrives. Optional: without one, or with one that isn't a turn id, the server picks it.
text/event-stream of draft events
curl -X POST 'http://localhost:7091/api/drafter/stream' \ -H 'Content-Type: application/json' \ -d '{ "messages": [ {} ], "recipe": "string"}'Report whether topic suggestions are available for an agent GET
Whether Draft with DocsGPT suggests Insights topics for an agent from its conversations: Insights sorts them (on this server and for the agent) and it had enough in the last 30 days. Returns {"available", "conversations", "needed", "reason"}; reason is disabled (the drafter is off), off_on_this_instance or turned_off_for_this_agent (Insights is off), with conversations 0 and uncounted, else null. Needs edit access to the agent: the suggestions read its users' questions. Not available to [personal access tokens](/API/personal-access-tokens); call it from a signed-in session.
Ask a running draft turn to stop POST
Stop the caller's draft turn: it makes no further model calls and its stream ends with end. The id is the turn_id the stream request sent, or the stream's first event (turn). A stop that arrives before the turn has started stops it as soon as it does. The stop is kept under the caller's name, so it never reaches another user's turn. Answers 202 once the request is stored, whether or not the caller has such a turn. Args: turn_id: The id the stream request sent, or the one its `turn` event carried. Returns: 202 when the stop was stored, 404 for a malformed id, 503 without Redis. Not available to [personal access tokens](/API/personal-access-tokens); call it from a signed-in session.