Agentic Execution

Agentic Execution

A LeafMesh LLM agent works like a capable engineer, not a form-filler: when a task depends on something it cannot know for certain, it uses its tools to find out before it answers. This is the default behavior of every LLM agent — there is no flag to turn it on.

The working loop

A normal agent turn is a loop, not a single call:

  1. The agent receives its task and context (upstream yields, memory, knowledge, chained inputs).
  2. It works: calls tools, reads the results, reacts, and calls more tools — as many rounds as the task needs — until it has arrived at the answer.
  3. Only then does it produce its final structured output (its declared yields).

The agent decides when it is done. The loop ends when the model stops calling tools, or when a guardrail ends it (the per-agent tool-call cap, the hard timeout, or a spent budget). If the remaining work can only proceed after time passes, the agent can schedule a follow-up to resume later instead of guessing.

Work first, format last

For an agent that both holds tools and owes a structured yields contract, the turn runs in two phases:

  • Workbench — the agent works with its tools and no output-shape constraint, so nothing pulls it toward answering prematurely.
  • Closing — once it stops acting, the agent formats what it actually established into the required yields JSON.

The result the mesh sees is identical to before — the same yields, feeding the same routing and downstream agents. Only the path to that result changes: the agent gets room to work before it has to commit to a shape. Agents that use no real tools, and agents that produce free text, are unaffected — they answer in a single call exactly as they always did.

Super agents are multiples of this loop

A super agent does not change how a single turn behaves. It plans the work into steps and runs each step — and each step is itself one of these working loops. Plan at the top, workbench inside every step: that composition is the whole of agentic behavior at scale.

Parallel tool use

Within a single turn, when an agent requests several independent tool calls at once, LeafMesh executes them concurrently (bounded, order-preserving). This is on by default; a turn that must run its tools strictly one after another can set allow_parallel_tool_calls: false on the agent. The concurrency ceiling is tunable with the limits.max_parallel_tool_calls config field (default 8).

Guardrails

The loop is bounded by the same controls that govern any agent:

  • max_tool_calls_per_message — the loop's hard iteration cap per turn.
  • llm_hard_timeout_s — a wall-clock ceiling per call.
  • monthly_token_budget / monthly_cost_budget — an agent that has spent its budget stops gracefully.
  • Reflection — a bounded self-correction pass when output doesn't satisfy the contract.

Model guidance

Capable models (Sonnet-class and above) genuinely act inside this loop. Smaller, faster models tend to answer immediately regardless of the harness — good for classification, extraction, and form-filling agents, less so for open-ended work. Choose the model to match how agentic the agent needs to be.

Last updated: 11/10/2026