SDK Reference
Overview

SDK Overview

The devteam-sdk package provides a typed TypeScript client for interacting with the DevTeam Orchestrator API. It handles authentication, request retries, WebSocket subscriptions, and type-safe response parsing.

Installation

npm install devteam-sdk

Basic Usage

import { DevTeamClient } from 'devteam-sdk';
 
const client = new DevTeamClient({
  apiUrl: 'https://devteam.marsala.dev',
  apiKey: process.env.DEVTEAM_API_KEY,
});

Module Structure

devteam-sdk
├── DevTeamClient          # Main client class
├── types/                 # TypeScript type definitions
│   ├── Task               # Task types
│   ├── Plan               # Plan/DAG types
│   ├── Template           # Template types
│   ├── HITL               # Human-in-the-Loop types
│   ├── WebSocket          # WebSocket event types
│   └── Error              # Error types
├── errors/                # Custom error classes
│   ├── DevTeamError       # Base error
│   ├── AuthError          # Authentication failures
│   ├── TimeoutError       # Request/task timeouts
│   └── ValidationError    # Input validation errors
└── utils/                 # Internal utilities
    ├── retry              # Retry logic
    ├── websocket          # WebSocket manager
    └── logger             # Structured logging

Core Capabilities

Client Methods Summary

MethodDescriptionSection
createTask()Submit a single taskTasks
getTaskStatus()Check task progressTasks
waitForTask()Block until task completesTasks
cancelTask()Cancel a running taskTasks
createPlan()Define a DAG workflowPlans
executePlan()Run a DAG planPlans
getPlanStatus()Check plan execution progressPlans
waitForPlan()Block until plan completesPlans
executeFanOut()Run tasks in parallelFan-Out
approveTask()Approve a HITL taskHITL
rejectTask()Reject a HITL taskHITL
getPendingApprovals()List tasks awaiting approvalHITL
deployTemplate()Deploy a workflow templateTemplates
listTemplates()Browse available templatesTemplates
subscribe()WebSocket event subscriptionClient

Error Handling

All SDK methods throw typed errors:

import { DevTeamError, AuthError, TimeoutError } from 'devteam-sdk';
 
try {
  const task = await client.createTask({ prompt: '...' });
} catch (error) {
  if (error instanceof AuthError) {
    console.error('Authentication failed:', error.message);
  } else if (error instanceof TimeoutError) {
    console.error('Request timed out after', error.timeoutMs, 'ms');
  } else if (error instanceof DevTeamError) {
    console.error('API error:', error.code, error.message);
  }
}

All errors include a requestId field that can be used for debugging with the DevTeam support team.

Next Steps

  • Client Reference -- Constructor options, authentication, and connection management
  • Tasks -- Working with individual tasks