Agent Architecture: How Agents Choose and Orchestrate Tools

Ask five engineers what an AI agent is and you will hear five answers, most of them a variation on "a prompt with a model behind it". That description is why agents so often end up as one long, unreviewable string of text. LVD takes a more disciplined view: an agent is a small, explicit configuration, and everything it does follows from a handful of named parts.

An agent is a configuration

Layer 8 holds the agents, and with a coefficient of 0.97 it is the most volatile layer on the server side. Only the UI above it changes faster. The book describes an agent as a bundle of five things: a name and version, a system prompt, the set of tools it may use (a subset of everything available), a collection of guardrail rules, and operational parameters such as temperature, token limits and memory window.

Spelling the parts out is useful because each one changes for different reasons and at a different speed. A versioned configuration can be diffed, reviewed and rolled back. A prompt buried in a service class cannot. Here is a tiny configuration of my own for a ride-hailing assistant:

export const rideHelper = {
  name: "RideHelper",
  version: "0.8.1",
  systemPrompt: "You help riders check, book and cancel trips. Be brief.",
  tools: ["get-trip", "estimate-fare", "request-ride", "cancel-ride"],
  guardrails: ["Confirm before requesting or cancelling a ride"],
  settings: { temperature: 0.3, maxTokens: 600, memoryWindow: 12 },
};

Agents also carry conversation state between turns: the history so far, entities extracted from it, any confirmation still pending and the workflow currently in progress. The memory window controls how many earlier turns the agent considers. A wider window gives more coherent replies but costs latency and tokens, and the book names tuning this setting as a primary reason the layer is so volatile.

Three ways to choose a tool

When a message arrives, the agent first works out what the user wants. That classification can be done by the language model itself, using the system prompt and the conversation, or by a separate lightweight classifier. The intent then maps to a subset of tools, and the book describes three strategies for using them.

  • Direct mapping. One intent, one tool. "Where is my driver?" goes straight to get-trip.
  • Sequential composition. One intent needs several tools in order. "Book me a ride to the airport" needs estimate-fare, then a decision by the rider, then request-ride.
  • Conditional branching. The next tool depends on what the last one returned. "Cancel my ride" starts with get-trip; if the driver has not left, cancel; if they have, explain the fee and ask first.

The strategies are not exclusive. A single conversation will usually use all three, and the skills the agent follows (see skills as documentation) tell it which pattern fits which job.

Parallel where independent, structured when things fail

If two tool calls do not depend on each other, they can run at the same moment and shave off latency. Fetching the driver's position and the current fare estimate is a good candidate. Requesting the ride is not, because it needs the estimate the rider has accepted. The agent has to recognise those data dependencies to know which calls may overlap.

Failure follows a ladder rather than improvisation:

  1. Classify the failure as transient (a timeout, a rate limit) or permanent (bad input, something not found).
  2. Retry transient failures, up to a configured maximum and with exponential backoff.
  3. For permanent failures, look for another tool that can satisfy the same intent.
  4. If nothing works, degrade gracefully: tell the user what happened and what they can do next.
  5. If the problem is unrecoverable and the need is urgent, hand the conversation to a human.

Where sequencing lives

This is the payoff of the layering. Axiom A5 stops tools from calling one another, so somebody above them has to decide what happens in what order. In an agent, that decision is made at run time, conversation by conversation, and its rules are tuned against task-completion results. It is a natural fit for the most volatile server-side layer, and a bad fit for anywhere stable. For the non-AI version of the same idea, see orchestrating tools and Axiom A5.

The takeaway

Treat an agent as a versioned configuration with named parts, and ask of every behaviour which part it belongs to. Once that is clear, the next question is how you watch it and fence it in, which is the subject of agent observability and guardrails.

What the book covers

  • The formal definition of an agent configuration
  • A complete shopping-assistant agent configuration
  • Conversation state management and the memory-window trade-off
  • Intent classification and the three tool-selection strategies
  • Parallel execution and a structured error-recovery protocol