Skip to main content
POST
/
api
/
v1
/
tasks
/
{runId}
/
continue
curl -X POST 'https://agent.blackbox.ai/api/v1/tasks/a1b2c3d4-e5f6-7890-abcd-ef1234567890/continue' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "prompt": "Now add unit tests for the new payment module"
  }'
{
  "runId": "c3d4e5f6-a7b8-9012-cdef-123456789012",
  "assistantMessageId": "msg_new_run_abc123",
  "chatId": "chat_def789ghi012",
  "previousRunId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
This endpoint continues an existing task by spawning a new agent run on the same chat thread (chatId). The agent receives the full conversation history as context and picks up where the previous run left off. If the original task worked on a GitHub repository, the agent will continue from the branch it created.

Authentication

To use this API, you need a BLACKBOX API Key. Follow these steps to get your API key:
  1. Go to app.blackbox.ai/agent-api and click Get an API Key (requires a Pro subscription)
  2. Once provisioning completes, you will be redirected to your Dashboard
  3. From the Dashboard, create an API key to use with all Agent API requests
Your API key will be in the format: sk-xxxxxxxxxxxxxxxxxxxxxx

GitHub Connection Required

For GitHub-related tasks: If the original task worked on a repository, the agent will automatically continue from the branch it created. Make sure your GitHub token is still stored via POST /api/v1/git/config — see Store GitHub Token for details.

Headers

Authorization
string
required
API Key of the form Bearer <api_key>.Example: Bearer sk_b41b647ffbfed27f616560
Content-Type
string
required
Must be set to application/json.

Path Parameters

runId
string
required
The runId of the previous task run to continue from.Example: a1b2c3d4-e5f6-7890-abcd-ef1234567890

Request Body

prompt
string
required
The follow-up instruction for the agent. The agent will receive the full prior conversation as context.Examples:
  • "Now add unit tests for the new module"
  • "The webhook handler is missing error handling, please fix it"
  • "Summarize what was done so far"
model
string
Override the model for this follow-up run. If you set model, you must also set agent (see the inheritance rule below). Omit both to keep the original run’s model.Example: "blackboxai/anthropic/claude-opus-4.7" — see Models for all available IDs.
agent
string
Explicit agent runtime for this turn — "claude" or "codex". Required whenever you change model (or otherwise override the runtime). Omit — together with model — to inherit the original run’s runtime.
Runtime inheritance rule. Continuation is designed so a plain follow-up “just continues” on the same setup:
  • Neither model nor agent specified → the follow-up inherits the original run’s model and agent runtime (even an explicit codex+opus override is preserved).
  • model and/or agent specified → you are overriding, so agent is required. This prevents a model swap from silently flipping the runtime. Omitting agent while setting model returns 400.
Example — continue on Codex with an Opus model: { "prompt": "...", "model": "blackboxai/anthropic/claude-opus-4.7", "agent": "codex" }.

Response Fields

runId
string
Unique identifier for the new agent run. Use this to poll status or stream logs.
assistantMessageId
string
ID of the assistant message being generated for this follow-up.
chatId
string
UUID of the shared chat thread (same as the original task’s chatId).
previousRunId
string
The runId of the task that was continued (the path parameter).

How Continuation Works

  1. Context restored — The agent loads the full message history from the shared chatId
  2. GitHub context restored — If the original task had a repo, the agent continues from the branch it created (githubCreatedBranch)
  3. New run created — A fresh agent run is spawned with the follow-up prompt appended to the conversation
  4. New runId returned — Use the new runId to track this follow-up independently
curl -X POST 'https://agent.blackbox.ai/api/v1/tasks/a1b2c3d4-e5f6-7890-abcd-ef1234567890/continue' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "prompt": "Now add unit tests for the new payment module"
  }'
{
  "runId": "c3d4e5f6-a7b8-9012-cdef-123456789012",
  "assistantMessageId": "msg_new_run_abc123",
  "chatId": "chat_def789ghi012",
  "previousRunId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}

Error Codes

Status CodeErrorDescription
200SuccessFollow-up run started successfully
400Bad RequestMissing prompt or invalid JSON
401UnauthorizedInvalid or missing API key
403ForbiddenPro subscription required, task belongs to another user, or no API key configured
404Not FoundPrevious task not found
500Internal Server ErrorFailed to spawn agent