Skip to main content

Operations Overview

Operations are the atomic building blocks of Conductor. Each operation does one thing well. Agents use operations to do work. Ensembles orchestrate agents. Operations are where the rubber meets the road.

The 12 Operations

Compute Operations

Execute logic and transform data.

Data Operations

Access and manipulate data stores.

storage

KV, D1, R2, Vectorize access

Communication Operations

Send messages and make requests.

Presentation Operations

Render content for users.

Extension Operations

Extend functionality with external tools.

tools

MCP tools and custom skills

Quick Reference

OperationUse CaseExample
thinkAI reasoning, text generationAnalyze sentiment, generate content
codeData transformation, business logicCalculate totals, format data
mlMachine learning inferenceImage classification, predictions
storageData persistence, cachingStore in D1, cache in KV
httpAPI calls, web requestsFetch external data
emailSend notificationsOrder confirmations, alerts
smsSend text messages2FA codes, alerts
htmlRender web pagesDashboard, reports
pdfGenerate documentsInvoices, reports
pageFull-stack componentsInteractive UIs
toolsExternal tool integrationWeb search, file operations

Common Configuration

All operations support:
operations:
  - name: my-operation
    operation: think  # Operation type
    config:
      # Operation-specific config
    condition: ${some.condition}  # Optional: when to run
    cache:
      ttl: 3600  # Optional: cache duration (seconds)
      key: custom-key  # Optional: cache key
    retry:
      maxAttempts: 3  # Optional: retry count
      backoff: exponential  # Optional: exponential or linear
      initialDelay: 1000  # Optional: ms before first retry
      maxDelay: 30000  # Optional: max delay between retries
    timeout: 30000  # Optional: timeout in ms

Output Access

Reference operation outputs:
${operation-name.output}          # Full output
${operation-name.output.field}    # Specific field
${operation-name.executed}        # true if ran
${operation-name.failed}          # true if failed
${operation-name.cached}          # true if from cache
${operation-name.duration}        # Execution time (ms)
${operation-name.retry_count}     # Number of retries

Performance Features

Automatic Parallelization

Operations without dependencies run in parallel:
operations:
  # These 3 run in parallel
  - name: fetch-a
    operation: http
    config:
      url: https://api-a.com

  - name: fetch-b
    operation: http
    config:
      url: https://api-b.com

  - name: fetch-c
    operation: http
    config:
      url: https://api-c.com

  # This waits for all 3
  - name: merge
    operation: code
    config:
      code: |
        return {
          a: ${fetch-a.output},
          b: ${fetch-b.output},
          c: ${fetch-c.output}
        };

Built-in Caching

Cache expensive operations:
operations:
  - name: expensive-ai
    operation: think
    config:
      provider: openai
      model: gpt-4o
      prompt: ${input.text}
    cache:
      ttl: 3600  # Cache for 1 hour
      key: ai-${input.text}

Automatic Retry

Retry failed operations:
operations:
  - name: flaky-api
    operation: http
    config:
      url: https://api.example.com
    retry:
      maxAttempts: 3
      backoff: exponential
      initialDelay: 1000

Error Handling

Conditional Execution

Skip operations on failure:
operations:
  - name: try-operation
    operation: http
    config:
      url: https://api.example.com

  - name: fallback
    condition: ${try-operation.failed}
    operation: http
    config:
      url: https://backup-api.com

outputs:
  data: ${try-operation.output || fallback.output}

Error Context

Access error details:
operations:
  - name: risky-op
    operation: http
    config:
      url: https://api.example.com

  - name: log-error
    condition: ${risky-op.failed}
    operation: storage
    config:
      type: d1
      query: INSERT INTO errors (error, timestamp) VALUES (?, ?)
      params:
        - ${risky-op.error}
        - ${Date.now()}

Best Practices

  1. Use the Right Operation - Each is optimized for its use case
  2. Cache Aggressively - Cache expensive operations
  3. Handle Failures - Use conditions and fallbacks
  4. Parallel by Default - Don’t create unnecessary dependencies
  5. Set Timeouts - Prevent hanging operations
  6. Monitor Performance - Track operation durations
  7. Test Thoroughly - Unit test each operation
  8. Version Components - Use Edgit for prompts/configs

Operation Comparison

When to Use What

think vs code:
  • Use think for AI reasoning, natural language
  • Use code for deterministic logic, calculations
storage (KV) vs storage (D1):
  • Use KV for caching, simple key-value
  • Use D1 for structured data, complex queries
http vs tools:
  • Use http for direct API calls
  • Use tools for MCP-compatible tools
email vs sms:
  • Use email for rich content, attachments
  • Use sms for urgent, short messages
html vs page:
  • Use html for simple rendering
  • Use page for full-stack, interactive UIs

Next Steps