Mahal Systems

Overview › Agent type

Web research

Browsing the open web to answer or research.

Specific to web research

  1. 8.b.i

    Tune the search tool: snippets, enough results, retries, reformulation, filters, source quality

    Make the search tool return what the model needs to choose what to open (a snippet per result, not just titles; five or more results; a full-document reader beside truncated search), retry failed searches, and reformulate when a query returns little (start broad, then narrow; use the corpus's own terms) rather than retrying it verbatim.

    Retrieval › Querying precisely

    Mixed qualityMixed cost

    Tier 2 · reliability · changes knowledge access · retrieval, web research agents · 8 sources, 3 measured

  2. 9.a.ii

    Verify citations claim by claim for factual support

    Extract claim-citation pairs deterministically, then check each: the link resolves, the source is relevant, and the source actually supports the claim.

    Verification › Checking externally

    Better qualityLower cost

    Tier 3 · tuning · changes control flow, knowledge access · web research, retrieval agents · 8 sources, 5 measured

General optimizations with evidence from web research

  1. 1.b.i

    Match the model and its effort to each call site and query class

    Pick the model per role or call site rather than one model everywhere, and set its reasoning effort and sampling parameters per site; tune each role's prompt to its model (GEPA raised every model tested at lower cost).

    Models › Finding specialists

    Better qualityLower cost

    Tier 3 · tuning · changes model, prompt · any agent · 19 sources, 6 measured

  2. 3.b.ii

    Mask tools instead of removing them

    When the tools an agent may use change mid-task (by mode, phase or permission), declare every tool once, keep the definitions byte-stable, and restrict the choice another way: OpenAI's allowed_tools or tool_choice "none", Anthropic's appended tool_removal and tool_addition blocks, a decode-time logit mask or grammar on self-hosted models, and a harness check that rejects calls outside the allowed set.

    Prompts › Caching

    Lower costFasterMore secureBetter governanceMixed quality

    Tier 3 · tuning · changes context, tool surface · any agent · 11 sources, 5 measured

  3. 5.c.ii

    Sub-agent architectures with clean contexts

    Hand a context-heavy side task (code search, reading many files, documents or logs) to a sub-agent that starts with a fresh context and only the tools it needs, and have it return a short result or file references so the parent's context stays small.

    Context › Isolating subtasks

    Mixed qualityMixed costMixed performance

    Tier 4 · restructuring · changes context · any agent · 12 sources, 10 measured

  4. 6.b.i

    Parallel tool execution for read-only calls

    Let the model put several independent read-only tool calls (searches, fetches, file reads) in one turn and have the harness run them at once, while calls that write, share state or need another call's result run one at a time in the order the model emitted them.

    Topologies › Parallelizing

    Lower costFasterMixed quality

    Tier 3 · tuning · changes control flow · any agent · 6 sources, 3 measured

  5. 6.b.iii

    Use multi-agent orchestration only for breadth-first, independent sub-tasks

    Spawn parallel sub-agents when the work splits into independent, breadth-first parts with little shared context; expect about 15x the tokens of a chat and up to 90% less wall-clock.

    Topologies › Parallelizing

    FasterMixed qualityHigher cost

    Tier 4 · restructuring · changes control flow, context · any agent · 22 sources, 7 measured

  6. 7.b.i

    Detect stalls and loops: warn, then stop early

    Track repeated identical actions (same tool, same arguments; same search query) and turns with no new information.

    Orchestration › Bounding execution

    Better qualityLower costFaster

    Tier 2 · reliability · changes control flow · any agent · 10 sources

  7. 7.b.iii

    Size run budgets so productive runs aren't cut off: turn caps, deadlines, command timeouts

    Set the turn or step cap, the wall-clock deadline and per-command timeouts from what runs that succeeded actually needed, not from framework defaults, so a run that is still making progress is not stopped short.

    Orchestration › Bounding execution

    Mixed costMixed performance

    Tier 2 · reliability · changes control flow · any agent · 4 sources

  8. 7.d.ii

    Inversion of control

    Give the agent the goal, the tools and the acceptance checks and let it choose the sequence of steps, instead of coding a fixed workflow; the goal, permissions, budget and evaluation stay outside the agent.

    Orchestration › Shaping the loop

    Mixed qualityHigher costSlower

    Tier 4 · restructuring · changes control flow · any agent · 6 sources, 4 measured

  9. 7.d.iii

    ReAct loop

    Run the agent as a loop: the model reasons, calls a tool, reads the result and picks the next step, until it answers or hits a cap.

    Orchestration › Shaping the loop

    Better qualityHigher costSlower

    Tier 4 · restructuring · changes control flow · any agent · 11 sources, 9 measured

  10. 9.a.i

    Feed back a sound external verifier's verdict; never the model's own critique

    Run a check the model cannot fool on its output (compiler, tests, schema validation, execution, EXPLAIN on generated SQL, a solver) and feed the verdict back; a pass/fail verdict is enough, and resampling until the check accepts works about as well as detailed feedback.

    Verification › Checking externally

    Better qualityHigher costSlower

    Tier 2 · reliability · changes control flow · any agent · 31 sources, 17 measured

Before you go...

Build better agents, weekly

Our latest research, performance benchmarks, optimization strategies, and updates around AOT development.

One email a week, nothing else. Unsubscribe anytime.