TypeScript types và JSON schemas cho toàn bộ data objects trong IAI Flow.
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
}
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;
}
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;
}
| Type | Mô tả | Key config |
|---|---|---|
claude | Call Claude AI | prompt, model, max_tokens |
ai.agent | Multi-step agent loop | system_prompt, tools[], max_iterations |
ai.prompt | Single AI prompt | prompt, model |
http_request | HTTP call | url, method, headers, body |
js_transform | JS transform | fn (JS code string) |
condition | Conditional branch | field, operator, value |
d1_query | D1 SQL query | sql, params |
kv_get | Read from KV | key |
kv_set | Write to KV | key, value |
log | Log output | message |
manual_trigger | Manual start | — |
schedule | Cron trigger | cron |
webhook | Webhook trigger | path |
http_trigger | HTTP trigger | — |
classify | Text classification | categories[] |
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;
}
interface SessionResponse {
authenticated: boolean;
user?: {
id: string;
email: string;
name?: string;
};
workspace?: {
workspaceId: string;
name: string;
role: "owner" | "admin" | "member" | "viewer";
};
}