Tasks API
The Tasks API allows you to manage tasks in the Bytebot agent system. It’s available at http://localhost:9991/tasks
when running the full agent setup.
Task Model
{
id : string ;
description : string ;
status : 'PENDING' | 'IN_PROGRESS' | 'NEEDS_HELP' | 'NEEDS_REVIEW' | 'COMPLETED' | 'CANCELLED' | 'FAILED' ;
priority : 'LOW' | 'MEDIUM' | 'HIGH' | 'URGENT' ;
createdAt : string ;
updatedAt : string ;
}
Endpoints
Create Task
Create a new task for the agent to process.
Request Body
{
"description" : "This is a description of the task"
}
Response
{
"id" : "task-123" ,
"description" : "This is a description of the task" ,
"status" : "PENDING" ,
"priority" : "MEDIUM" ,
"createdAt" : "2025-04-14T12:00:00Z" ,
"updatedAt" : "2025-04-14T12:00:00Z"
}
Get All Tasks
Retrieve a list of all tasks.
Response
[
{
"id" : "task-123" ,
"description" : "This is a description of the task" ,
"status" : "PENDING" ,
"priority" : "MEDIUM" ,
"createdAt" : "2025-04-14T12:00:00Z" ,
"updatedAt" : "2025-04-14T12:00:00Z"
},
// ...more tasks
]
Get In-Progress Task
Retrieve the currently in-progress task, if any.
GET /tasks/in-progress Get the currently in-progress task
Response
{
"id" : "task-123" ,
"description" : "This is a description of the task" ,
"status" : "IN_PROGRESS" ,
"priority" : "MEDIUM" ,
"createdAt" : "2025-04-14T12:00:00Z" ,
"updatedAt" : "2025-04-14T12:00:00Z"
}
If no task is in progress, the response will be null
.
Get Task by ID
Retrieve a specific task by its ID.
Response
{
"id" : "task-123" ,
"description" : "This is a description of the task" ,
"status" : "PENDING" ,
"priority" : "MEDIUM" ,
"createdAt" : "2025-04-14T12:00:00Z" ,
"updatedAt" : "2025-04-14T12:00:00Z" ,
"messages" : [
{
"id" : "msg-456" ,
"content" : [
{
"type" : "text" ,
"text" : "This is a message"
}
],
"role" : "USER" ,
"taskId" : "task-123" ,
"createdAt" : "2025-04-14T12:05:00Z" ,
"updatedAt" : "2025-04-14T12:05:00Z"
}
// ...more messages
]
}
Update Task
Update an existing task.
Request Body
{
"status" : "COMPLETED" ,
"priority" : "HIGH"
}
Response
{
"id" : "task-123" ,
"description" : "This is a description of the task" ,
"status" : "COMPLETED" ,
"priority" : "HIGH" ,
"createdAt" : "2025-04-14T12:00:00Z" ,
"updatedAt" : "2025-04-14T12:01:00Z"
}
Delete Task
Delete a task.
Response
Status code 204 No Content
with an empty response body.
Message Content Structure
Messages in the Bytebot agent system use a content block structure compatible with Anthropic’s Claude API:
type MessageContent = MessageContentBlock [];
interface MessageContentBlock {
type : string ;
[ key : string ]: any ;
}
interface TextContentBlock {
type : "text" ;
text : string ;
}
interface ImageContentBlock {
type : "image" ;
source : {
type : "base64" ;
media_type : string ;
data : string ;
};
}
Error Responses
The API may return the following error responses:
Status Code Description 400
Bad Request - Invalid parameters 404
Not Found - Resource does not exist 500
Internal Server Error - Server side error
Example error response:
{
"statusCode" : 404 ,
"message" : "Task with ID task-123 not found" ,
"error" : "Not Found"
}
Code Examples
const axios = require ( 'axios' );
async function createTask ( description ) {
const response = await axios . post ( 'http://localhost:9991/tasks' , {
description
});
return response . data ;
}
async function findInProgressTask () {
const response = await axios . get ( 'http://localhost:9991/tasks/in-progress' );
return response . data ;
}
// Example usage
async function main () {
// Create a new task
const task = await createTask ( 'Compare React, Vue, and Angular for a new project' );
console . log ( 'Created task:' , task );
// Get current in-progress task
const inProgressTask = await findInProgressTask ();
console . log ( 'In progress task:' , inProgressTask );
}