Conductor TypeScript SDK Examples

March 10, 2026 · View on GitHub

Quick reference for example files demonstrating SDK features.

:rocket: Quick Start

npm install
export CONDUCTOR_SERVER_URL=http://localhost:8080
npx ts-node examples/workers-e2e.ts

:file_folder: Examples by Category

Core Workers

FileDescriptionRun
workers-e2e.ts:star: Start here — 3 chained workers end-to-endnpx ts-node examples/workers-e2e.ts
quickstart.ts60-second intro: @worker + ConductorWorkflow + executenpx ts-node examples/quickstart.ts
helloworld.tsMinimal complete workflow lifecyclenpx ts-node examples/helloworld.ts
worker-configuration.tsPer-worker config: concurrency, poll interval, domainnpx ts-node examples/worker-configuration.ts
task-context.tsTaskContext: logging, callbacks, IN_PROGRESS patternnpx ts-node examples/task-context.ts
task-configure.tsProgrammatic task defs: retry policies, timeouts, rate limitsnpx ts-node examples/task-configure.ts
event-listeners.tsCustom TaskRunnerEventsListener hooksnpx ts-node examples/event-listeners.ts
express-worker-service.tsExpress.js HTTP server + Conductor workers in one processnpx ts-node examples/express-worker-service.ts

Workflows

FileDescriptionRun
dynamic-workflow.tsBuild workflows programmatically with switch, loop, inlinenpx ts-node examples/dynamic-workflow.ts
kitchensink.tsAll major task types in one workflownpx ts-node examples/kitchensink.ts
workflow-ops.tsLifecycle: start, pause, resume, terminate, restart, retry, searchnpx ts-node examples/workflow-ops.ts
test-workflows.tsUnit testing with mock task outputs (no workers needed)npx ts-node examples/test-workflows.ts

AI/LLM Workflows

Require an LLM integration configured in Conductor. Set LLM_PROVIDER and LLM_MODEL env vars.

FileDescriptionRun
agentic-workflows/llm-chat.tsTwo LLMs in automated multi-turn conversationnpx ts-node examples/agentic-workflows/llm-chat.ts
agentic-workflows/llm-chat-human-in-loop.tsInteractive chat with WAIT tasks for human inputnpx ts-node examples/agentic-workflows/llm-chat-human-in-loop.ts
agentic-workflows/function-calling.tsLLM dynamically picks which worker to callnpx ts-node examples/agentic-workflows/function-calling.ts
agentic-workflows/mcp-weather-agent.tsMCP tool discovery + invocation for real-time datanpx ts-node examples/agentic-workflows/mcp-weather-agent.ts
agentic-workflows/multiagent-chat.tsMulti-agent debate: optimist vs skeptic with moderatornpx ts-node examples/agentic-workflows/multiagent-chat.ts

Monitoring

FileDescriptionRun
metrics.tsMetricsCollector + MetricsServer on :9090 (Prometheus)npx ts-node examples/metrics.ts
event-listeners.tsCustom poll/execution/failure event hooksnpx ts-node examples/event-listeners.ts

Advanced

FileDescriptionNotes
advanced/fork-join.tsParallel branches with ConductorWorkflow.fork()Both 3-branch and 2-branch shown
advanced/http-poll.tsHTTP polling with fixed and linear backoffConfigurable strategies
advanced/sync-updates.tsUpdate variables and task outputs at runtimeExternal system integration
advanced/wait-for-webhook.tsWebhook-driven workflow pausesExternal signal completion
advanced/sub-workflows.tsRegistered + inline sub-workflow compositiontoSubWorkflowTask()
advanced/rag-workflow.tsRAG pipeline: index → search → LLM answerRequires vector DB + LLM
advanced/vector-db.tsEmbeddings: generate, store, search, indexRequires vector DB
advanced/human-tasks.tsHuman-in-the-loop: claim, update, completeHumanExecutor API

:dart: API Journey Examples

End-to-end examples covering all APIs for each domain client.

Authorization Journey

FileDescriptionAPIs
api-journeys/authorization.tsFull authorization lifecycle17 API calls

Scenario: Create users and groups, manage membership, grant and revoke permissions, verify access, clean up.

Features:

  • User CRUD (upsert, get, list, delete)
  • Group CRUD (upsert, get, list, delete)
  • Group membership (add/remove users)
  • Permission management (grant, get, check, remove)
  • Granted permission queries (user + group)
npx ts-node examples/api-journeys/authorization.ts

Metadata Journey

FileDescriptionAPIs
api-journeys/metadata.tsFull metadata lifecycle21 API calls

Scenario: Register tasks and workflows, manage tags, configure rate limits, bulk operations, clean up.

Features:

  • Task definition CRUD (register, get, update, unregister, batch)
  • Workflow definition CRUD (register, get, unregister)
  • Tag management (add, get, set, delete for both tasks and workflows)
  • Rate limit management (set, get, remove)
  • Bulk operations (getAllTaskDefs, getAllWorkflowDefs)
npx ts-node examples/api-journeys/metadata.ts

Prompt Journey

FileDescriptionAPIs
api-journeys/prompts.tsFull prompt lifecycle9 API calls

Scenario: Save prompt templates, update, test against LLM, manage tags, list all, delete.

Features:

  • Prompt CRUD (save, get, update, delete)
  • Tag management (set, get, delete)
  • Test prompts against LLM with variables
  • List all prompt templates
npx ts-node examples/api-journeys/prompts.ts

Schedule Journey

FileDescriptionAPIs
api-journeys/schedules.tsFull schedule lifecycle13 API calls

Scenario: Create cron schedules, pause/resume, search executions, manage tags, preview next runs, clean up.

Features:

  • Schedule CRUD (save, get, delete)
  • Pause and resume schedules
  • Search schedule executions
  • Get next N execution times
  • Tag management (set, get, delete)
  • List all schedules (with optional workflow filter)
npx ts-node examples/api-journeys/schedules.ts

Secrets Journey

FileDescriptionAPIs
api-journeys/secrets.tsFull secret lifecycle12 API calls

Scenario: Store secrets, verify existence, retrieve, update, manage tags, list names, clean up.

Features:

  • Secret CRUD (put, get, delete)
  • Existence check
  • Tag management (set, get, delete)
  • List all secret names
  • List grantable secrets
npx ts-node examples/api-journeys/secrets.ts

Integrations Journey

FileDescriptionAPIs
api-journeys/integrations.tsFull integration lifecycle22 API calls

Scenario: Register providers and APIs, query integrations, manage tags, associate prompts, clean up.

Features:

  • Provider CRUD (save, get, list, delete)
  • Integration API CRUD (save, get, list, delete)
  • Query integrations (all, by category, available APIs, definitions)
  • Tag management (provider tags + integration tags)
  • Prompt association (associate, get)
npx ts-node examples/api-journeys/integrations.ts

Schema Journey

FileDescriptionAPIs
api-journeys/schemas.tsFull schema lifecycle10 API calls

Scenario: Register JSON schemas, create new versions, retrieve by name and version, list all, clean up.

Features:

  • Schema registration (single + batch)
  • Version management (create new versions)
  • Retrieval (by name, by name + version, list all)
  • Deletion (by version, by name)
npx ts-node examples/api-journeys/schemas.ts

Application Journey

FileDescriptionAPIs
api-journeys/applications.tsFull application lifecycle20 API calls

Scenario: Create applications, manage access keys, assign roles, manage tags, clean up.

Features:

  • Application CRUD (create, get, update, list, delete)
  • Access key management (create, list, toggle, delete)
  • Role management (add, remove)
  • Tag management (add, get, delete)
npx ts-node examples/api-journeys/applications.ts

Event Handler Journey

FileDescriptionAPIs
api-journeys/event-handlers.tsFull event handler lifecycle18 API calls

Scenario: Create event handlers, update configuration, filter by event and status, manage tags, query queues, clean up.

Features:

  • Event handler CRUD (add, get, update, list, delete)
  • Event handler filtering (by event, active only)
  • Tag management (add, get, delete)
  • Queue configuration (list queue names)
  • Event execution views
npx ts-node examples/api-journeys/event-handlers.ts

:mortar_board: Learning Path

Start simple and build up:

# 1. Hello world (2 min)
npx ts-node examples/helloworld.ts

# 2. Multiple workers end-to-end (5 min)
npx ts-node examples/workers-e2e.ts

# 3. All task types (5 min)
npx ts-node examples/kitchensink.ts

# 4. Workflow lifecycle operations (5 min)
npx ts-node examples/workflow-ops.ts

# 5. Worker configuration + context (5 min)
npx ts-node examples/worker-configuration.ts
npx ts-node examples/task-context.ts

# 6. Event listeners + metrics (5 min)
npx ts-node examples/event-listeners.ts
npx ts-node examples/metrics.ts

# 7. Advanced patterns (10 min)
npx ts-node examples/advanced/fork-join.ts
npx ts-node examples/advanced/sub-workflows.ts

# 8. API journeys (10 min each)
npx ts-node examples/api-journeys/metadata.ts
npx ts-node examples/api-journeys/authorization.ts

# 9. AI/LLM workflows (requires LLM integration)
npx ts-node examples/agentic-workflows/function-calling.ts
npx ts-node examples/agentic-workflows/multiagent-chat.ts

:package: Package Structure

examples/
├── quickstart.ts                    # 60-second intro
├── helloworld.ts                    # Minimal lifecycle
├── dynamic-workflow.ts              # Programmatic workflow builder
├── kitchensink.ts                   # All major task types
├── workflow-ops.ts                  # Workflow lifecycle management
├── workers-e2e.ts                   # Multiple workers end-to-end
├── test-workflows.ts                # Mock-based workflow testing
├── worker-configuration.ts          # Config hierarchy + env vars
├── task-context.ts                  # TaskContext usage
├── task-configure.ts                # Programmatic task definitions
├── event-listeners.ts               # Custom event listener hooks
├── metrics.ts                       # Prometheus metrics + HTTP server
├── express-worker-service.ts        # Express.js + workers integration

├── agentic-workflows/               # AI/LLM agent examples
│   ├── llm-chat.ts                  # Multi-turn automated AI conversation
│   ├── llm-chat-human-in-loop.ts    # Interactive chat with WAIT pauses
│   ├── function-calling.ts          # LLM-driven function routing
│   ├── mcp-weather-agent.ts         # MCP tool discovery + invocation
│   └── multiagent-chat.ts           # Multi-agent debate with moderator

├── api-journeys/                    # Complete API lifecycle demos
│   ├── authorization.ts             # Users, groups, permissions (17 calls)
│   ├── metadata.ts                  # Tasks, workflows, tags, rate limits (21 calls)
│   ├── prompts.ts                   # Prompt templates (9 calls)
│   ├── schedules.ts                 # Workflow schedules (13 calls)
│   ├── secrets.ts                   # Secret management (12 calls)
│   ├── integrations.ts              # Providers, APIs, tags (22 calls)
│   ├── schemas.ts                   # Schema definitions (10 calls)
│   ├── applications.ts             # Applications, access keys, roles (20 calls)
│   └── event-handlers.ts           # Event handlers, queues, tags (18 calls)

└── advanced/                        # Advanced workflow patterns
    ├── fork-join.ts                 # Parallel execution with join
    ├── http-poll.ts                 # HTTP polling with backoff
    ├── sync-updates.ts              # Runtime state updates
    ├── wait-for-webhook.ts          # Webhook-driven workflows
    ├── sub-workflows.ts             # Workflow composition
    ├── rag-workflow.ts              # RAG pipeline (index → search → answer)
    ├── vector-db.ts                 # Vector DB operations
    └── human-tasks.ts              # Human-in-the-loop workflow

:wrench: Configuration

Worker Architecture

import { OrkesClients, TaskHandler, worker, simpleTask, ConductorWorkflow } from "@io-orkes/conductor-javascript";
import type { Task, TaskResult } from "@io-orkes/conductor-javascript";

// 1. Define workers with @worker decorator
@worker({ taskDefName: "my_task", concurrency: 5, pollInterval: 100 })
async function myTask(task: Task): Promise<TaskResult> {
  return { status: "COMPLETED", outputData: { result: "done" } };
}

// 2. Connect to Conductor
const clients = await OrkesClients.from();

// 3. Build and register workflows
const wf = new ConductorWorkflow(clients.getWorkflowClient(), "my_workflow")
  .add(simpleTask("my_ref", "my_task", { key: "${workflow.input.key}" }));
await wf.register();

// 4. Start workers + execute
const handler = new TaskHandler({ client: clients.getClient(), scanForDecorated: true });
await handler.startWorkers();
const run = await wf.execute({ key: "value" });
await handler.stopWorkers();

Environment Variables

VariableDescriptionDefault
CONDUCTOR_SERVER_URLConductor server URLRequired
CONDUCTOR_AUTH_KEYAuthentication key ID
CONDUCTOR_AUTH_SECRETAuthentication secret
LLM_PROVIDERLLM integration nameopenai_integration
LLM_MODELLLM model namegpt-4o
EMBEDDING_PROVIDEREmbedding model integrationopenai_integration
EMBEDDING_MODELEmbedding model nametext-embedding-3-small
VECTOR_DBVector DB integration namepinecone_integration
VECTOR_INDEXVector DB index namevaries
MCP_SERVERMCP server integration nameweather_mcp_server

:bug: Common Issues

Workers don't pick up tasks

  • Ensure CONDUCTOR_SERVER_URL is set correctly
  • Workers must be started (handler.startWorkers()) before executing workflows
  • Check the taskDefName matches between @worker and simpleTask

Decorator errors (TS1206)

  • Add "experimentalDecorators": true to your tsconfig.json
  • Or use npx ts-node --compiler-options '{"experimentalDecorators":true}'

Express example requires express

  • Install: npm install express @types/express

AI/LLM examples fail

  • Requires an LLM integration configured in Conductor (e.g., OpenAI)
  • Set LLM_PROVIDER and LLM_MODEL environment variables
  • Verify the integration is active in the Conductor UI

Vector DB examples fail

  • Requires a vector DB integration (e.g., Pinecone, Weaviate)
  • Set VECTOR_DB and VECTOR_INDEX environment variables

:books: Documentation