Docs
Optimization pattern guides
These are common issues Papaya finds in the workflows we test. Individual findings are tailored to a specific workflow, while these pages explain the broader pattern, impact, and common fixes.
Give the model the context it needs before the decision point
The workflow begins making decisions before it has the customer, policy, state, or domain facts needed to stay grounded.
Unused contextStop sending context that later steps do not use
Prompts carry large stable or retrieved context even though the next decision does not materially use it.
Oversized contextTrim large payloads before they enter reasoning steps
Raw tool, retrieval, or schema payloads flow into later prompts when the next step only needs a few fields.
Repeated prompt fragmentsReuse stable instructions instead of copying them into every call
The same system, policy, or formatting text is copied across many runs or stages instead of being reused once.
Clarification burdenCollect required inputs before starting the workflow
Users get follow-up questions only after the workflow has already spent tokens on reasoning or tool work.
Retry loopsChange strategy or stop instead of retrying the same failed path
A failed operation repeats without changing the inputs, constraints, or recovery strategy that caused the failure.
Truncation/resume churnPersist compact state so resumed work does not rebuild context
Long-running workflows lose or rebuild important state after truncation, resume, or handoff points.
Tool misuseValidate inputs before running expensive tools
Tools run before the workflow has enough context, permission, or constraints to use their results correctly.
Tool error loopHandle repeated tool failures with a new path
The same tool error gets copied into the prompt and retried without a new recovery plan.
Composite tool opportunityBundle repeated low-level calls into one domain-level tool
Related records are fetched one at a time, leaving the model to assemble data that a domain tool could return directly.
Mutation safetyValidate state-changing actions before they execute
State-changing actions can execute without enough quote, dry-run, or validation evidence.
State delta groundingMake requested changes and preserved state explicit
The workflow identifies the requested change but does not separately ground the fields that must remain unchanged.
Output contract mismatchMake the final answer match the required contract
Useful content still fails the workflow when required fields, format, refusal behavior, or schema rules are missing.
Outcome cohort gapCompare failing and passing runs before changing the workflow
Passing and failing runs diverge in behavior, but the workflow keeps routing them through the same path.
Evaluation coverageAdd enough labels before optimizing quality
The workflow lacks enough outcome labels or score coverage to know whether optimization changes are safe.
Model right-sizingUse expensive models only where reasoning requires them
Broad reasoning models are being used for constrained extraction, routing, formatting, or classification work.
Delegated task overheadKeep delegated work bounded and compact
Sub-agents isolate work, then send back long narrative payloads that the parent has to read and synthesize again.
Workflow orderingRun validation and prerequisites before expensive branches
Steps run before their prerequisites are settled, creating rework or decisions based on incomplete state.
Template opportunityTurn repeated successful paths into reusable templates
Many successful runs already follow the same shape, making the workflow a strong candidate for a shared template.
Missing verification gateAdd a final verification gate before packaging the answer
The workflow packages an answer without checking it against task, format, and safety requirements.
Retrieval strategyFilter retrieval before it reaches the reasoning step
Retrieval brings back too many weak candidates, forcing later model calls to sort through irrelevant material.
Prompt caching reuseCache stable prompt content that repeats across runs
Large invariant context or instructions are sent repeatedly instead of using prompt caching or references.