Skip to content
Get started

Retrieve a worker

client.Workers.Get(ctx, workerID, query) (*Worker, error)
GET/api/workers/{workerId}

Retrieve the current worker state and messages from its most recent task (or a specific task via taskId).

ParametersExpand Collapse
workerID string
query WorkerGetParams
TaskID param.Field[string]Optional

Return the worker state and messages for a specific task instead of the most recent one.

minLength1
ReturnsExpand Collapse
type Worker struct{…}
ID string
CreatedAt int64
Error any
Files []WorkerFile
Filename string
MediaType string
URL string
formaturi
Size int64Optional
minimum0
IncompleteDetails any
Messages []any
Metadata map[string, any]
Object Worker
Output []WorkerOutput
ID string
Content []WorkerOutputContent
Text string
Type OutputText
Role Assistant
Status Completed
Type Message
OutputText string
Running bool
Sources []WorkerSource
ID string
Title string
Type URL
URL string
Status WorkerStatus
One of the following:
const WorkerStatusRunning WorkerStatus = "running"
const WorkerStatusCompleted WorkerStatus = "completed"
const WorkerStatusPending WorkerStatus = "pending"
StructuredOutput map[string, any]
URL string

Web URL of the worker in the Handinger dashboard.

Usage WorkerUsageOptional
DurationMs int64Optional
minimum0

Retrieve a worker

package main

import (
  "context"
  "fmt"

  "github.com/ramensoft/handinger-go"
  "github.com/ramensoft/handinger-go/option"
)

func main() {
  client := handinger.NewClient(
    option.WithAPIKey("My API Key"),
  )
  worker, err := client.Workers.Get(
    context.TODO(),
    "t_org_123_w_01HZY2ZJQ8G7K42W2D7WF6V4GM",
    handinger.WorkerGetParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", worker.ID)
}
{
  "id": "id",
  "created_at": 0,
  "error": null,
  "files": [
    {
      "filename": "filename",
      "mediaType": "mediaType",
      "url": "https://example.com",
      "size": 0
    }
  ],
  "incomplete_details": null,
  "messages": [
    {}
  ],
  "metadata": {
    "foo": "bar"
  },
  "object": "worker",
  "output": [
    {
      "id": "id",
      "content": [
        {
          "text": "text",
          "type": "output_text"
        }
      ],
      "role": "assistant",
      "status": "completed",
      "type": "message"
    }
  ],
  "output_text": "output_text",
  "running": true,
  "sources": [
    {
      "id": "id",
      "title": "title",
      "type": "url",
      "url": "url"
    }
  ],
  "status": "running",
  "structured_output": {
    "foo": "bar"
  },
  "url": "https://v3.handinger.com/worker/wrk_vk81XUHKHG-qr4",
  "usage": {
    "durationMs": 0
  }
}
Returns Examples
{
  "id": "id",
  "created_at": 0,
  "error": null,
  "files": [
    {
      "filename": "filename",
      "mediaType": "mediaType",
      "url": "https://example.com",
      "size": 0
    }
  ],
  "incomplete_details": null,
  "messages": [
    {}
  ],
  "metadata": {
    "foo": "bar"
  },
  "object": "worker",
  "output": [
    {
      "id": "id",
      "content": [
        {
          "text": "text",
          "type": "output_text"
        }
      ],
      "role": "assistant",
      "status": "completed",
      "type": "message"
    }
  ],
  "output_text": "output_text",
  "running": true,
  "sources": [
    {
      "id": "id",
      "title": "title",
      "type": "url",
      "url": "url"
    }
  ],
  "status": "running",
  "structured_output": {
    "foo": "bar"
  },
  "url": "https://v3.handinger.com/worker/wrk_vk81XUHKHG-qr4",
  "usage": {
    "durationMs": 0
  }
}