AI / LlamaIndex Interview Questions
Explain the internal working of AgentWorkflow and event-driven workflows in LlamaIndex?
LlamaIndex Workflows are an event-driven orchestration primitive: instead of writing one linear function, you define a set of steps, each a Python method decorated with @step, and each step declares what Event type it consumes and what Event type it produces.
Execution begins when a StartEvent is emitted, and the workflow engine routes it to whichever step is listening for that event type, running steps as their required events become available. This naturally supports branching, since different events can trigger different steps, and loops, since a step can emit an event type that routes back to an earlier step, which is how an agent's reasoning loop keeps calling tools until it decides it has enough information.
AgentWorkflow is a built-in workflow constructed on top of this engine specifically for orchestrating one or more agents, including handing off a task between multiple specialized agents mid-run. It replaced older, more rigid agent runner classes because the event-driven model makes it straightforward to insert custom steps, such as a human-approval checkpoint, without restructuring the whole agent loop.
More Related questions...