Workflow is the durable task state machine. Session is one execution attempt inside that workflow. The runtime must preserve the relationship explicitly so clients can inspect, resume, and debug long tasks without guessing from logs.
activities[] remain readable.WorkflowRunSnapshot.sessionLinks[] is the canonical workflow-to-session index. When it is missing
or empty, clients may derive equivalent links from activities[].
interface WorkflowSessionLink {
activityId: string;
attempt: number;
kind:
| "agent_session"
| "planner_agent"
| "subplanner_agent"
| "actor_agent"
| "critic_agent";
model?: string;
nodeId?: string;
parentSessionId?: string;
phase: string;
runId: string;
sessionId?: string;
startedAt: string;
completedAt?: string;
status:
| "starting"
| "running"
| "retrying_model"
| "waiting_permission"
| "completed"
| "failed"
| "cancelled";
traceId?: string;
turnId?: string;
}
activityId is stable for a single execution attempt. attempt is scoped by (phase, nodeId,
kind), so retrying the same node creates a new activity and increments the visible attempt count.
model when the child runtime is created so model changes during a workflow are auditable.Session metadata should eventually carry the reverse reference:
interface SessionWorkflowReference {
activityId: string;
nodeId?: string;
phase: string;
runId: string;
}
sessionLinks[].sessionLinks[] can be derived from activities[].