Schemas

WorkflowDefinition

interface WorkflowDefinition {
  name: string;
  entry?: string;            // node id of entry point
  nodes: NodeDefinition[];
  edges: EdgeDefinition[];
}

interface NodeDefinition {
  id: string;
  type: string;              // claude | http_request | js_transform | ...
  name?: string;
  config: Record<string, unknown>;
}

interface EdgeDefinition {
  id: string;
  source: string;            // source node id
  target: string;            // target node id
  condition?: string;        // optional JS expression
}

ExecutionRun

interface ExecutionRun {
  id: string;
  workflow_id: string;
  workflow_name?: string;
  status: "pending" | "running" | "success" | "failed";
  triggered_by?: "manual" | "schedule" | "webhook" | "api";
  input?: unknown;
  output?: unknown;
  error_text?: string;
  duration_ms?: number;
  node_count?: number;
  workspace_id?: string;
  started_at?: string;
  finished_at?: string;
  created_at: string;
}

ExecutionStepLog

interface ExecutionStepLog {
  id: string;
  run_id: string;
  node_id: string;
  node_type: string;
  node_name?: string;
  status: "success" | "failed" | "skipped";
  input?: unknown;
  output?: unknown;
  error?: string;
  duration_ms?: number;
  started_at: string;
  finished_at: string;
}

Node Types

TypeMô tảKey config
claudeCall Claude AIprompt, model, max_tokens
ai.agentMulti-step agent loopsystem_prompt, tools[], max_iterations
ai.promptSingle AI promptprompt, model
http_requestHTTP callurl, method, headers, body
js_transformJS transformfn (JS code string)
conditionConditional branchfield, operator, value
d1_queryD1 SQL querysql, params
kv_getRead from KVkey
kv_setWrite to KVkey, value
logLog outputmessage
manual_triggerManual start
scheduleCron triggercron
webhookWebhook triggerpath
http_triggerHTTP trigger
classifyText classificationcategories[]

AgentMemory

interface AgentMemory {
  id: string;
  agent_id: string;
  run_id?: string;
  workspace_id?: string;
  key: string;
  value_json: string;      // JSON-serialized value
  scope: "session" | "persistent";
  ttl_seconds?: number;
  created_at: string;
  updated_at: string;
}

Session

interface SessionResponse {
  authenticated: boolean;
  user?: {
    id: string;
    email: string;
    name?: string;
  };
  workspace?: {
    workspaceId: string;
    name: string;
    role: "owner" | "admin" | "member" | "viewer";
  };
}