Skip to content
Get started

Create a worker template

workers.create(WorkerCreateParams**kwargs) -> WorkerTemplate
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
instructions: Optional[str]

Persistent system prompt the worker uses for every task it runs.

maxLength20000
output_schema: Optional[Dict[str, object]]

Optional JSON Schema (Draft-07) describing the structured object the worker must produce. When set, every task response is validated against the schema and exposed as structuredOutput.

prompt: Optional[str]

Natural-language description of the worker to use for AI-generated instructions when instructions is omitted.

maxLength10000
summary: Optional[str]

Short one-line description of the worker’s purpose. Auto-generated when omitted and a prompt is provided.

maxLength80
title: Optional[str]

Optional display name. When omitted, Handinger assigns a random dog-themed name.

minLength1
maxLength200
visibility: Optional[Literal["public", "private"]]

public (default) is visible to all org members. private is only visible to invited members.

One of the following:
"public"
"private"
ReturnsExpand Collapse
class WorkerTemplate:
id: str
created_at: Optional[str]
instructions: str
organization_id: str
output_schema: Optional[Dict[str, object]]
summary: str
title: str
updated_at: Optional[str]
url: str

Web URL of the worker in the Handinger dashboard.

user_id: str
visibility: Literal["public", "private"]
One of the following:
"public"
"private"

Create a worker template

import os
from handinger import Handinger

client = Handinger(
    api_key=os.environ.get("HANDINGER_API_KEY"),  # This is the default and can be omitted
)
worker_template = client.workers.create(
    prompt="A worker that fact-checks short claims and returns a verdict with citations.",
)
print(worker_template.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"
}