Skip to content
Get started

Workers

Create a worker
client.Workers.New(ctx, body) (*Worker, error)
POST/api/workers
Retrieve a worker
client.Workers.Get(ctx, workerID, query) (*Worker, error)
GET/api/workers/{workerId}
Continue a worker
client.Workers.Continue(ctx, workerID, body) (*Worker, error)
POST/api/workers/{workerId}
Stream worker updates
client.Workers.StreamUpdates(ctx, workerID) (*string, error)
GET/api/workers/{workerId}/stream
Retrieve a worker email address
client.Workers.GetEmail(ctx, workerID) (*string, error)
GET/api/workers/{workerId}/email
Retrieve a worker file
client.Workers.GetFile(ctx, filePath, query) (*Response, error)
GET/api/workers/{workerId}/files/{filePath}
ModelsExpand Collapse
type CreateWorker struct{…}
Input string
minLength1
Budget CreateWorkerBudgetOptional
One of the following:
const CreateWorkerBudgetLow CreateWorkerBudget = "low"
const CreateWorkerBudgetStandard CreateWorkerBudget = "standard"
const CreateWorkerBudgetHigh CreateWorkerBudget = "high"
const CreateWorkerBudgetUnlimited CreateWorkerBudget = "unlimited"
Stream boolOptional
type Worker struct{…}
ID string
CreatedAt int64
Error any
Files []WorkerFile
Filename string
MediaType string
URL string
IncompleteDetails any
Messages []any
Metadata map[string, any]
Object WorkerObject
Output []WorkerOutput
ID string
Content []WorkerOutputContent
Text string
Type string
Role string
Status string
Type string
OutputText string
Running bool
Sources []WorkerSource
ID string
Title string
Type string
URL string
Status WorkerStatus
One of the following:
const WorkerStatusRunning WorkerStatus = "running"
const WorkerStatusCompleted WorkerStatus = "completed"
const WorkerStatusPending WorkerStatus = "pending"
Costs WorkerCostsOptional
InternalCostUsd float64
minimum0
ModelCostUsd float64
minimum0
SandboxCostUsd float64
minimum0
ToolCostUsd float64
minimum0
Usage WorkerUsageOptional
CacheReadTokens int64
minimum0
CacheWriteTokens int64
minimum0
CostUsd float64
minimum0
InputTokens int64
minimum0
OutputTokens int64
minimum0
ReasoningTokens int64
minimum0
Steps int64
minimum0
TotalTokens int64
minimum0
Credits int64Optional
minimum0

WorkersSchedules

Manage future and recurring worker tasks.

List worker schedules
client.Workers.Schedules.List(ctx, workerID) (*WorkerScheduleListResponse, error)
GET/api/workers/{workerId}/schedules
Create a worker schedule
client.Workers.Schedules.New(ctx, workerID, body) (*WorkerScheduleUnion, error)
POST/api/workers/{workerId}/schedules
Cancel a worker schedule
client.Workers.Schedules.Cancel(ctx, scheduleID, body) (*WorkerScheduleCancelResponse, error)
DELETE/api/workers/{workerId}/schedules/{scheduleId}
ModelsExpand Collapse
type WorkerScheduleUnion interface{…}
One of the following:
type WorkerScheduleObject struct{…}
ID string
Budget string
One of the following:
const WorkerScheduleObjectBudgetLow WorkerScheduleObjectBudget = "low"
const WorkerScheduleObjectBudgetStandard WorkerScheduleObjectBudget = "standard"
const WorkerScheduleObjectBudgetHigh WorkerScheduleObjectBudget = "high"
const WorkerScheduleObjectBudgetUnlimited WorkerScheduleObjectBudget = "unlimited"
Input string
NextRunAt Time
formatdate-time
Type string
type WorkerScheduleObject struct{…}
ID string
Budget string
One of the following:
const WorkerScheduleObjectBudgetLow WorkerScheduleObjectBudget = "low"
const WorkerScheduleObjectBudgetStandard WorkerScheduleObjectBudget = "standard"
const WorkerScheduleObjectBudgetHigh WorkerScheduleObjectBudget = "high"
const WorkerScheduleObjectBudgetUnlimited WorkerScheduleObjectBudget = "unlimited"
DelayInSeconds int64
Input string
NextRunAt Time
formatdate-time
Type string
type WorkerScheduleObject struct{…}
ID string
Budget string
One of the following:
const WorkerScheduleObjectBudgetLow WorkerScheduleObjectBudget = "low"
const WorkerScheduleObjectBudgetStandard WorkerScheduleObjectBudget = "standard"
const WorkerScheduleObjectBudgetHigh WorkerScheduleObjectBudget = "high"
const WorkerScheduleObjectBudgetUnlimited WorkerScheduleObjectBudget = "unlimited"
Cron string
Input string
NextRunAt Time
formatdate-time
Type string
type WorkerScheduleObject struct{…}
ID string
Budget string
One of the following:
const WorkerScheduleObjectBudgetLow WorkerScheduleObjectBudget = "low"
const WorkerScheduleObjectBudgetStandard WorkerScheduleObjectBudget = "standard"
const WorkerScheduleObjectBudgetHigh WorkerScheduleObjectBudget = "high"
const WorkerScheduleObjectBudgetUnlimited WorkerScheduleObjectBudget = "unlimited"
Input string
IntervalSeconds int64
NextRunAt Time
formatdate-time
Type string