Skip to content
Get started

Create a worker template

client.Workers.New(ctx, body) (*WorkerTemplate, error)
POST/api/workers

Create a new worker. The worker is a reusable agent template; tasks are runs against this template. Use POST /tasks to actually run the agent.

ParametersExpand Collapse
body WorkerNewParams
CreateWorker param.Field[CreateWorker]
ReturnsExpand Collapse
type WorkerTemplate struct{…}
ID string
CreatedAt string
Instructions string
OrganizationID string
OutputSchema map[string, any]
Summary string
Title string
UpdatedAt string
URL string

Web URL of the worker in the Handinger dashboard.

UserID string
Visibility WorkerTemplateVisibility
One of the following:
const WorkerTemplateVisibilityPublic WorkerTemplateVisibility = "public"
const WorkerTemplateVisibilityPrivate WorkerTemplateVisibility = "private"

Create a worker template

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"),
  )
  workerTemplate, err := client.Workers.New(context.TODO(), handinger.WorkerNewParams{
    CreateWorker: handinger.CreateWorkerParam{

    },
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", workerTemplate.ID)
}
{
  "id": "id",
  "createdAt": "createdAt",
  "instructions": "instructions",
  "organizationId": "organizationId",
  "outputSchema": {
    "foo": "bar"
  },
  "summary": "summary",
  "title": "title",
  "updatedAt": "updatedAt",
  "url": "https://v3.handinger.com/worker/wrk_vk81XUHKHG-qr4",
  "userId": "userId",
  "visibility": "public"
}
Returns Examples
{
  "id": "id",
  "createdAt": "createdAt",
  "instructions": "instructions",
  "organizationId": "organizationId",
  "outputSchema": {
    "foo": "bar"
  },
  "summary": "summary",
  "title": "title",
  "updatedAt": "updatedAt",
  "url": "https://v3.handinger.com/worker/wrk_vk81XUHKHG-qr4",
  "userId": "userId",
  "visibility": "public"
}