Mahal Systems

Overview › Lever

Tool surface

Tool names, schemas, descriptions, return size, typed tools vs code execution. 7 optimizations change this part of an agent.

  1. 2.a.i
    Tools › Refactoring

    Better qualityLower costMixed performance

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

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

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

    Tools › Refactoring

    Lower costMixed quality

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

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

    Tools › Avoiding misuse

    Better qualityHigher cost

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

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

    Tools › Avoiding misuse

    Better quality

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

  6. 2.c.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.

    Tools › Trimming results

    Lower costFasterMixed quality

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

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

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.