Skip to content

8. Layer 3: Tools & Actions ​

Problem Solved ​

Tools give the agent access to information and actions outside the model’s parameters.

Without tools, the system can only generate text. With tools, the system can search, compute, read, write, call APIs, run simulations, or change external state.

Service Provided to the Layer Above ​

Layer 3 gives the control loop controlled capabilities and returns observations that can be added to context.

Tool Contract ​

Every tool should have an explicit contract.

Contract elementPurpose
NameStable identifier used by the model
DescriptionTells the model when the tool is useful
ParametersDefines required and optional inputs
PermissionsStates what resources the tool may touch
Side-effect classIndicates whether the tool reads, computes, mutates, or communicates
Output formatDefines what observation the harness will return
Failure behaviorDefines timeouts, retries, and error observations

A tool is more than a callable function, because it sits at a policy boundary where the harness enforces permissions, validates arguments, checks risk class, and decides whether the requested action is safe to execute (16)(17).

Tool Risk Classes ​

Risk classExamplesRequired controlsUnintended consequence
Read-onlySearch, fetch record, list filesInput validation, rate limitsExtra cost and latency from too many queries (e.g., several searches before finding the right data).
ComputationCalculate, transform data, run pure simulationResource limits, timeoutResource exhaustion or infinite loops from unbounded computation.
MutationUpdate database, edit file, create objectSandbox, audit, rollback where possibleData corruption or inconsistent state from partial or overlapping writes.
External communicationSend message, post request, publish eventApproval gates, allowlists, idempotencySpam, wrong recipients, or duplicate messages if idempotency is missing.
Irreversible actionDelete, pay, deploy, terminateHuman approval or strong deterministic policyPermanent data loss, financial loss, or outage from targeting the wrong object.

Execution Environment ​

Tool execution should occur in an environment whose permissions are known.

Environment propertyWhy it matters
IsolationPrevents one agent task from damaging the host or other tasks
Permission scopeLimits file, network, database, and API access
Resource limitsPrevents runaway CPU, memory, time, or cost
AuditabilityRecords what was executed and what it touched
Rollback strategySupports recovery when a mutation is wrong

The exact mechanism may be a local sandbox, container, remote executor, or managed service (18). The architectural requirement is bounded side effect.

Observations ​

An observation is the result of an action, returned to the agent’s context.

Good observations are:

  • Structured
  • Concise
  • Actionable
  • Explicit about success or failure
  • Safe to include in context
  • Enough to make the next decision

Bad observations are:

  • Huge raw dumps with no summary
  • Empty success messages with no useful state
  • Errors that do not explain what constraint was violated
  • Secrets or credentials leaked into context
  • Partial results presented as complete

Observation design is part of agent design. A tool that returns useless observations forces the model to guess.

Design Rules ​

  1. Prefer few precise tools over many vague tools.
  2. Write tool descriptions for the model, not just for humans.
  3. Make read-only tools the default during exploration.
  4. Separate mutation tools from read tools.
  5. Return errors as observations, not only as logs.
  6. Store large artifacts outside context and reference them by state keys.
  7. Make irreversible actions require stronger approval.
  8. Enforce tool permissions in the harness, not in the prompt.

Failure Modes ​

FailureSymptomFix
Tool hallucinationModel requests a tool that does not existTool allowlist and validation
Wrong argumentsValid tool called with bad valuesArgument schemas and policy checks
Observation bloatContext fills with raw tool outputSummarization, pagination, state keys
Unsafe side effectTool mutates or deletes unexpected stateSandboxing, permission scopes, approval gates
TimeoutTool takes too longExecution limits and cancellation
Partial mutationSome changes succeed, others failTransactions, idempotency, rollback
Ambiguous failureModel cannot recover from errorStructured error observations with next-step hints