S C P A M T E G  Module Lifecycle

Where each namespace module fires during pipeline execution. Not what the modules are — where they act.

1. The Execution Timeline

When a pipeline runs, modules fire at specific phases. This diagram shows every phase in order, and which modules are active. Read top to bottom — that's the execution order.

Build Time
.build() or .to_app() — before any LLM call
IR compile
P prompt assembled C context strategy set G guards → callbacks T tools resolved
Contracts
E check_contracts() S .produces() / .consumes() verified
Per Turn
For each user message or pipeline step
State in
S S.capture() / S.transform() A A.snapshot() → state
before_agent
M M.retry() wraps M M.log() records M M.latency() starts timer
Context filter
C C.none() / C.from_state() / C.window() → filters history before LLM sees it
before_model
G G.input() validates G G.rate_limit() checks M M.cache() checks hit
LLM Call
The actual model inference — prompt goes in, response comes out
Prompt
P P.role() + P.task() + P.constraint() C filtered history injected T tool schemas attached
Model out
LLM response (text or tool call)
Post-Model
After the LLM responds, before the user sees it
after_model
G G.json() validates G G.pii() redacts G G.length() checks M M.cost() records tokens
Tool Call
If the LLM decides to call a tool
before_tool
T T.confirm() prompts user T T.cache() checks hit M M.log() records call
tool exec
T T.fn() / T.agent() / T.mcp() → .inject() provides deps
after_tool
T T.transform() reshapes output M M.log() records result
State Out
Agent response flows to state and next agent
State out
S .writes("key") → state A A.publish() → artifact M M.latency() stops timer
after_agent
M M.log() records completion E .eval() scores quality

2. How Modules Relate

Not all modules interact. This grid shows which modules compose with which, and what the relationship means. Hover for details.

S
C
P
A
M
T
E
G
S
·
·
C
·
·
·
·
·
P
·
·
·
·
A
·
·
·
·
·
·
M
·
·
·
·
T
·
·
·
·
E
·
·
·
·
G
·
·
·
·
·

bidirectional   feeds into   reads from   · independent (different lifecycle phases or concerns)

3. Step Through a Real Pipeline

Click each node to see exactly which modules fire, what they do, and the code that triggers them. This is the Deep Research hero workflow.

Click a node above to begin
Each node shows which modules are active and why. The modules don't exist in isolation — they fire at specific points in the execution lifecycle to solve specific problems.

4. Execution Sequence Diagrams

These are auto-generated from pipeline definitions using .to_sequence_diagram(). They show the actual message flow — what calls what, in what order, and what data moves where.