Mahal Systems

Overview › Agent type

Retrieval

Fetching knowledge the model lacks: RAG, search over docs, knowledge bases, customer systems.

Specific to retrieval

  1. 8.a.i

    Choose the retriever by corpus size and question type

    On a bounded corpus (up to about 100K documents), grep and file reads over the raw text beat an embedding retriever: the agent narrows into documents it has found.

    Retrieval › Expanding sources

    Better qualityLower cost

    Tier 3 · tuning · changes knowledge access, control flow · retrieval agents · 25 sources, 22 measured

  2. 8.a.ii

    Surface information the source holds but the agent cannot read

    Find information a connected source holds that the agent never reads, and expose it.

    Retrieval › Expanding sources

    Better quality

    Tier 3 · tuning · changes knowledge access · retrieval, data analysis, document extraction agents · 11 sources, 3 measured

  3. 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

  4. 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 retrieval

  1. 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

  2. 6.b.ii

    LLM map-reduce

    Give each piece of a large or untrusted input its own tool-less model call that sees only that piece and must answer in a fixed schema, then combine the answers in code or in a reducer that never sees the raw text.

    Topologies › Parallelizing

    More secureBetter governanceMixed qualityMixed costMixed performance

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

  3. 7.a.ii

    Prompt chaining with gate checks

    Split a task that decomposes cleanly into fixed steps into a chain of model calls, one goal per call, with a gate between steps: a schema check, an assertion, or a run against the real system, and an LLM check only for subjective criteria.

    Orchestration › Routing

    Better qualityMore secureBetter governanceBetter for brandHigher costSlower

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

  4. 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

  5. 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

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.