Delta Agents logoDelta Agents

Types

Complete type reference for all public types

Authoring types

Action

type Action = {
  name: string;
  description: string;
  schema: ZodObject;
  risk?: 1 | 2 | 3 | 4 | 5;
  estimatedCost?: Cost;
  requiresApproval?: boolean;
  prerequisites?: {
    actions?: string[];
    workflows?: string[];
  };
  hooks?: Hooks;
  tools?: string[];
  fn: (data: ActionInput, ctx: ActionContext) => Promise<ResultType>;
};

ActionContext

type ActionContext = {
  taskId: string;
  executionId: string;
  agentName: string;
  phase?: string;
  storyline?: string;
  phaseStoryline?: string;
  goal?: string;
  workflowName?: string;
  availableSkills?: Array<{ name: string; description: string; content?: string }>;
  attachments?: Attachment[];
  communicate?: (channelType: string, body: string) => Promise<ResultType>;
  remember?: (content: string, kind?: string) => Promise<ResultType>;
  recall?: (query: string) => Promise<ResultType>;
  budget?: { spent: Cost; limit?: Cost };
};

Hooks

type Hooks = {
  before?: (ctx: ActionContext) => Promise<ResultType>;
  after?: (ctx: ActionContext & { result: unknown }) => Promise<ResultType>;
  onError?: (ctx: ActionContext & { error: string }) => Promise<ResultType>;
};

type AfterHookFn = (ctx: ActionContext & { result: unknown }) => Promise<ResultType>;
type ErrorHookFn = (ctx: ActionContext & { error: string }) => Promise<ResultType>;

Workflow

type Workflow = {
  name: string;
  description: string;
  storyline?: string;
  version: string;
  phases: Phase[];
  estimatedCost?: Cost;
  hooks?: Hooks;
};

Phase

type Phase = {
  name: string;
  description: string;
  storyline?: string;
  actions: ActionRef[];
  checkpoint: boolean;
  supervision?: SupervisionPolicy;
  hooks?: Hooks;
  tools?: string[];
};

ActionRef / Branch

type ActionRef = string | Branch;

type Branch = {
  action: string;
  onSuccess?: string;
  onFailure?: string;
  when?: (ctx: ActionContext & { lastOutcome?: { action: string; ok: boolean; error?: string } }) => boolean;
};

Agent

type Agent = {
  name: string;
  description: string;
  role: string;
  rolePrompt: string;
  model?: string;
  contextWindow?: number;
  actions: Action[];
  workflows?: Workflow[];
  skills?: Skill[];
  channels?: Channel[];
  dataSources?: DataSource[];
  team?: string;
};

Tool

type Tool = {
  name: string;
  description: string;
  schema: ZodObject<ZodRawShape>;
  skills?: (string | Skill)[];
  fn: (ctx: { data: unknown; ctx: ToolContext }) => Promise<Result<unknown, string>>;
  limits?: {
    maxCallsPerPhase?: number;
    maxCallsPerTask?: number;
    cooldownMs?: number;
  };
  cost?: Cost;
  budget?: Cost;
};

ToolContext

type ToolContext = {
  agentName: string;
  taskId: string;
  goal?: string;
  phaseName?: string;
  toolHistory: ToolHistoryEntry[];
  attachments?: Attachment[];
};

Event types

type DeltaEventEnvelope = {
  timestamp: number;
  agentName: string;
};

type DeltaEventDelivered<E extends keyof DeltaEventPayloads> = 
  DeltaEventPayloads[E] & DeltaEventEnvelope;

Every event delivered to delta.events.on() carries a timestamp (milliseconds since epoch, stamped when the event is emitted) and agentName (the agent executing the task). Handlers receive the full event payload merged with the envelope.

Skill

type Skill = {
  name: string;
  description: string;
  folder: string;
};

Channel

type Channel = {
  type: SupportedChannels;
  enabled: boolean;
  sendMessage: (message: string, ctx: ChannelContext) => Promise<ResultType>;
  retrieveMessages?: (ctx: ChannelContext) => Promise<ResultType>;
  replyMessage?: (id: string, message: string, ctx: ChannelContext) => Promise<ResultType>;
};

DataSource

type DataSourceOwnership = "internal" | "external";

type DataSourceAuthentication = {
  type: string;
};

type DataSource = {
  name: string;
  description: string;
  ownership: DataSourceOwnership;
  contentType: string;
  authentication?: DataSourceAuthentication;
  actions: {
    retrieve?: Action;
    create?: Action;
    update?: Action;
    delete?: Action;
  };
};

SupervisionPolicy

type SupervisionPolicy = {
  strategy: "retry" | "restart" | "resume" | "escalate" | "abort-subtree" | "abort-tree";
  maxRetries: number;
};

Engine types

DeltaEngineConfig

type DeltaEngineConfig = {
  store?: StoragePort;
  endpoint?: string;
  apiKey?: string;
  options?: ModelOptions;
  models?: ModelDef[];
  reasoner?: ReasonerPort;
  maxStepsPerTask?: number;
  providerRetry?: Partial<RetryOptions>;
  systemPrompt?: string;
  timezone?: string;
  logger?: LoggerConfig;
  cache?: CacheConfig;
  diagnostics?: DiagnosticsConfig;
  commitContextLimit?: number;
  commitMaxRetries?: number;
  tools?: ToolsConfig;
  mailbox?: { inboxCap?: number };
};

ModelDef

type ModelDef = {
  name: string;
  model: string;
  default?: boolean;
  endpoint?: string;
  apiKey?: string;
  options?: ModelOptions;
  vision?: boolean;
  audio?: boolean;
};

SendInput

type SendInput = {
  goal: string;
  agentName: string;
  budget?: Cost;
  workflow?: string;
  input?: Record<string, string | number | boolean | null>;
  actionInputs?: Record<string, Record<string, string | number | boolean | null>>;
  attachments?: AttachmentInput[];
};

SendResult

type SendResult = {
  taskId: string;
  status: "completed" | "failed" | "blocked" | "queued" | "pendingCommit";
  snapshot: TaskStateSnapshot;
  reason?: string;
};

InspectResult

type InspectResult = {
  task: Task;
  executions: Execution[];
  latestCheckpoint: Checkpoint | null;
  escalations: EscalationRecord[];
  pendingApprovals: ApprovalRequest[];
};

InvokeArgs

type InvokeArgs = {
  tool: string;
  input: unknown;
  ctx?: Partial<ToolContext>;
};

Shared types

Cost

type Cost = {
  tokens: number;
  durationMs: number;
  memory?: number;
  latency?: number;
  money?: Money;
  content?: ContentCost;
};

Money

type Money = {
  value: number;
  currency: string; // ISO 4217, e.g. "USD", "EUR", "NGN"
};

Attachment

type AttachmentInput = {
  kind: "image" | "file" | "audio";
  mimeType: string;
  data?: string;
  url?: string;
  name?: string;
};

type Attachment = AttachmentInput & { id: string };

Task

type Task = {
  id: string;
  rootId: string;
  parentId?: string;
  status: ExecutionStatus;
  goal: string;
  assignedAgent: string;
  workflow?: string;
  currentPhase?: string;
  budget: Cost;
  risk: RiskState;
  trust: TrustState;
  createdAt: Date;
  updatedAt: Date;
};

Message

type Message = {
  id: string;
  taskId: string;
  sender: string;
  receiver: string;
  payload: unknown;
  createdAt: Date;
  deliveredAt?: Date;
  readAt?: Date;
  recalledAt?: Date;
  consumed: boolean;
};

Commit

type Commit = {
  id: string;
  agentName: string;
  taskId: string;
  workflowName: string | null;
  phaseName: string | null;
  checkpointId: string | null;
  notes: string;
  createdAt: Date;
};

RosterEntry

type RosterEntry = {
  agentName: string;
  goal: string;
  status: string;
  activeSubtasks: number;
  queuedCount: number;
  overloaded: boolean;
};

CleanupOptions

type CleanupOptions = {
  taskRetentionMs?: number;
  messageRetentionMs?: number;
  evictCache?: boolean;
};

On this page