Mahal Systems

Overview › 2Tools

Tools

6 optimizations in 3 sub-categories.

a.Refactoring

Refactor & combine

  1. i.

    Better qualityLower costMixed performance

    Tier 1 · hygiene · changes tool surface, context · tool use agents · 32 sources, 23 measured

  2. ii.

    Rewrite the tool surface: names, schemas, descriptions

    Change what the model sees of each tool without touching its implementation: a distinct name, a strict schema (enums, required fields), and a description with fixed sections (what it is for and when to use it versus sibling tools, defaults and limits, error modes, side effects), plus a usage example for complex parameters.

    Better qualityMixed costMixed performance

    Tier 1 · hygiene · changes tool surface · tool use agents · 18 sources, 8 measured

  3. iii.

    Choose how the agent acts: typed tools, code execution, or shell, matched to the model and task

    Decide the action interface deliberately, by model and by task, and provision what it needs.

    Lower costMixed quality

    Tier 3 · tuning · changes tool surface, model · tool use agents · 22 sources, 10 measured

b.Avoiding misuse

  1. i.

    Make tool calls and tool results fail soft, and retry transient failures

    Keep a failed call from ending the run: validate tool calls and model responses, return tool errors to the agent as results, and retry only failures that are transient and safe to repeat.

    Better qualityHigher cost

    Tier 2 · reliability · changes tool surface, control flow · tool use agents · 9 sources, 4 measured

  2. ii.

    Tell the agent when to use each tool, in context it always sees

    For each tool or skill that is under-used or misused, add an explicit trigger rule where the model always sees it (system prompt, AGENTS.md): the situation that calls for the tool, and what to use it instead of (e.g.

    Better quality

    Tier 3 · tuning · changes tool surface, prompt · tool use agents · 9 sources, 4 measured

See also

  1. 2.a.ii

    Rewrite the tool surface: names, schemas, descriptions

    Change what the model sees of each tool without touching its implementation: a distinct name, a strict schema (enums, required fields), and a description with fixed sections (what it is for and when to use it versus sibling tools, defaults and limits, error modes, side effects), plus a usage example for complex parameters.

    Tools › Refactoring

    Better qualityMixed costMixed performance

    Tier 1 · hygiene · changes tool surface · tool use agents · 18 sources, 8 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

c.Trimming results

Return only what the model needs

  1. i.

    Bound tool output: cap it, or write it to a file the agent can read

    Cap the characters of tool output kept per call (VeRO settled near 15-20 KB on TerminalBench), or, better, write long output to a file and return its path with a short head, so the agent can read more if it needs to.

    Lower costFasterMixed quality

    Tier 3 · tuning · changes tool surface, context · any agent · 7 sources

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.