The model should not read every row, log line, or metric point; code should reduce evidence before reasoning starts. Database automation produces large outputs: query plans, lock tables, schema dumps, slow-query samples, replication metrics, audit logs, and Terraform plans. Passing raw output into the model is expensive and often less accurate.

Situation

Database automation produces large outputs: query plans, lock tables, schema dumps, slow-query samples, replication metrics, audit logs, and Terraform plans. Passing raw output into the model is expensive and often less accurate.

The pattern matters for database, cloud, and platform teams because agents do not operate in a vacuum. They inherit repository rules, tool permissions, deployment workflows, incident history, and the quality of the evidence available to them.

Operating layerDefault approachBetter alternative
ContextRely on a long prompt or chat historyGive the agent task-specific evidence and rules
ToolingExpose broad tools and inspect laterExpose narrow tools with clear approval boundaries
VerificationRead the final answerCheck the artifact, trace, and final state

The Problem

The agent needs the signal, not the dump. Raw outputs waste context and make the next step depend on accidental formatting.

The practical question is not whether an agent can produce a convincing response. The question is whether the engineering system around that response makes the work observable, reversible, and reviewable.

Failure pointWhat breaksWhy it matters
Weak boundaryAgent authority is broader than the taskA diagnostic run can become an unsafe change
Missing evidenceThe agent cannot cite the state it usedReview becomes opinion instead of verification
No lifecycleThe workflow ends at a messageOwnership, audit, cleanup, and rollback disappear

Programmatic Tool Gateway

Put a programmatic gateway between operational systems and the model. The gateway executes trusted scripts, filters raw output, computes deltas, and returns a compact evidence packet.

flowchart TD
    A[task request — bounded intent] --> B[programmatic tool gateway — controls]
    B --> C[tool execution — evidence collected]
    C --> D[verification — final state checked]
    D --> E[human handoff — audit retained]
  1. Define the operating boundary.
    Write down the task class, allowed tools, environment, data class, and approval mode before the agent runs.

  2. Shape the evidence.
    Return compact observations instead of raw dumps. The agent should see enough to reason, but not so much that context is wasted.

  3. Require proof of completion.
    Completion should be an artifact or state check: a passing test, a reviewed plan, a valid rollback, a trace, or a linked ticket.

For each DB tool, define raw command, parser, summary schema, thresholds, and evidence links. The model receives the summary and can request raw evidence only when needed.

In Practice

Context: Anthropic’s advanced tool use material describes programmatic patterns where tool calls and intermediate processing happen in code, with only relevant results returned to the model. Source: Anthropic, Introducing advanced tool use.

Action: For each DB tool, define raw command, parser, summary schema, thresholds, and evidence links. The model receives the summary and can request raw evidence only when needed.

Result: This preserves context for reasoning while keeping deterministic parsing in code where it can be tested.

Learning: Put a programmatic gateway between operational systems and the model. The gateway executes trusted scripts, filters raw output, computes deltas, and returns a compact evidence packet. This is a documented pattern or a direct consequence of how the named systems behave, not a fabricated production story.

Where It Breaks

Failure modeTriggerFix
Model as parserLLM parses huge raw outputsUse code parsers first
Lost detailSummary hides important anomalyAttach raw artifact reference
Untested parserGateway drops fields silentlyUnit test parsers with fixture outputs
No schemaReturned summaries varyUse stable JSON or Markdown tables

What to Do Next

  • Problem: The agent needs the signal, not the dump. Raw outputs waste context and make the next step depend on accidental formatting.
  • Solution: Put a programmatic gateway between operational systems and the model. The gateway executes trusted scripts, filters raw output, computes deltas, and returns a compact evidence packet.
  • Proof: This preserves context for reasoning while keeping deterministic parsing in code where it can be tested.
  • Action: Wrap one slow-query diagnostic command with a script that returns only plan root, top cost nodes, buffers, row estimate error, and suggested next observation.

The teams that get value from agents will not be the teams with the longest prompts. They will be the teams that turn agent work into a controlled engineering workflow.