System Internals

No Magic. Just Execution.

This page documents how AI Agent Automation actually runs workflows — from task creation to final persistence — with nothing hidden.

The Execution Spine

Every workflow execution follows the same immutable path. No shortcuts. No branching logic injected by agents.

Task Creation

A trigger (manual, scheduler, webhook, or API) creates a Task document in MongoDB with steps, edges, and initial context.

Task Claiming

The worker polls for PENDING tasks and atomically marks one as RUNNING using MongoDB findOneAndUpdate with $set.

Context Initialization

The runner builds an execution context containing workflow input, step outputs, variables, and metadata.

Step Execution

The executor dispatches each step to the correct handler. Parallel branches acquire distributed locks before executing.

Result Persistence

Step results, logs, and trace IDs are written to the database. Socket.IO broadcasts progress to connected clients.

Completion

The task is marked COMPLETED, FAILED, PENDING_APPROVAL, or REJECTED. No further steps run unless explicitly resumed.