Agent loop playground and cost simulator
Give the loop a task.
Watch the path unfold.
A Pi-style execution canvas. Explore how a prompt becomes model turns, tool calls, observations, and a final response.
Keyword rule matched “refund”. Review or override the template; this is not a model-generated plan.
Execution steps 12 mock events · select a step to focus the canvas
How this preview works. A local rule selects a fixed example template. The loop shape follows context preparation, assistant responses, tool execution, and tool-result feedback in Pi’s agent loop. Domain tools, retry choices, and outputs are mock fixtures. No arbitrary-prompt understanding, real execution, hidden model reasoning, or performance measurement is claimed.
Playback speed controls the animation only. The trace is not a cost estimate or a Pi-compatible event export. Dragging a node changes its position, not the execution order.
Cost planning / separate exampleCompare the three-turn refund workflow
The existing editable cost model uses a fixed refund scenario. Its prices and timings do not describe the mock path above.
Open cost model
Compare the three-turn refund workflow
The existing editable cost model uses a fixed refund scenario. Its prices and timings do not describe the mock path above.
One task. Three turns.
Where does a decision model fit?
Explore a refund-support loop. Change the assumptions and compare an LLM-only workflow with one bounded decision delegated to Jev.
“Review a refund request, look up the order and policy, create a handling ticket, and draft a reply.”
Understand & extract
LLMExtract the order ID and request the lookup tools. Free-form understanding stays with the LLM.
Turn 1 assumptions
Parallel · slower tool sets the duration
Choose handling route
Jev candidateChoose a predefined queue, such as standard review or specialist review. Code maps the label to the ticket action.
LLM and Jev assumptions
Draft the response
LLMGenerate a customer-facing reply. This turn retains its full input and output budget in both plans.
Turn 3 assumptions
Task complete · 3 model stages, 3 tool calls
Hybrid is an expected mean across accepted and fallback paths. No measured percentiles.
An assumed rate, not a confidence threshold. Each fallback pays for both the Jev attempt and the LLM decision.
What you are paying for
Turns 1 and 3 stay. Only the middle decision changes.
When does the cost advantage disappear?
Hold the task constant. Vary how often Jev falls back.
Inspect every assumption.
Replace example rates and timings with your own. Numeric edits apply on Enter or when you leave a field.
Model prices USD per million tokens
One LLM tariff across all turns. Jev output is unmetered in this template. No cache discounts, batch rates, tool fees, or infrastructure costs.
Tool execution Critical path, not sum of all spans
Calculation method & boundaries
Cost: LLM-only = turn 1 + turn 2 + turn 3. Hybrid = turn 1 + Jev + fallback rate × turn 2 + turn 3. Each LLM turn costs (input tokens × input price + output tokens × output price) / 1,000,000.
Time: use the same model-stage calculation with latency, then add lookup time and ticket time to both plans. Parallel lookup time is the maximum of the two durations. Sequential lookup time is their sum.
Context: each input count is the complete request, including history, tool results, and schemas. Replacing turn 2 does not automatically shrink turn 3. Context growth is not assumed to be exponential.
Eligibility: turn 2 is replaceable only when labels and tool arguments are already fixed. Code must enforce deterministic policy, authorization, and validation. No refund is executed in this example.
Scope: a simplified Pi-style model → tools → model loop, not a Pi integration. It excludes open-ended planning, retries, tool failures, compaction, and additional turns. Fallback is assumed to use the same turn-2 LLM budget and duration. Jev latency must include representative failed-attempt or timeout overhead.
Validate next: measure task success, accepted-decision errors, fallback frequency, token usage, and end-to-end duration on your workload. The lowest modeled cost is not evidence of the best policy.