Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
A comprehensive collection of Agent Skills for context engineering, multi-agent architectures, and production agent systems.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
skills/tool-design/references/architectural_reduction.md
1# Architectural Reduction: Production Evidence23This document provides detailed evidence and implementation patterns for the architectural reduction approach to agent tool design.45## Case Study: Text-to-SQL Agent67A production text-to-SQL agent was rebuilt using architectural reduction principles. The original architecture used specialized tools with heavy prompt engineering and careful context management. The reduced architecture used a single bash command execution tool.89### Original Architecture (Many Specialized Tools)1011The original system included:12- GetEntityJoins: Find relationships between entities13- LoadCatalog: Load data catalog information14- RecallContext: Retrieve previous context15- LoadEntityDetails: Get entity specifications16- SearchCatalog: Search data catalog17- ClarifyIntent: Clarify user intent18- SearchSchema: Search database schema19- GenerateAnalysisPlan: Create query plan20- FinalizeQueryPlan: Complete query plan21- FinalizeNoData: Handle no-data cases22- JoinPathFinder: Find join paths23- SyntaxValidator: Validate SQL syntax24- FinalizeBuild: Complete query build25- ExecuteSQL: Run SQL queries26- FormatResults: Format query results27- VisualizeData: Create visualizations28- ExplainResults: Explain query results2930Each tool solved a specific problem the team anticipated the model would face. The assumption was that the model would get lost in complex schemas, make bad joins, or hallucinate table names.3132### Reduced Architecture (Two Primitive Tools)3334The reduced system included:35- ExecuteCommand: Run arbitrary bash commands in a sandbox36- ExecuteSQL: Run SQL queries against the database3738The agent explores the semantic layer using standard Unix tools:3940```python41from vercel_sandbox import Sandbox4243sandbox = Sandbox.create()44await sandbox.write_files(semantic_layer_files)4546def execute_command(command: str):47"""Execute arbitrary bash command in sandbox."""48result = sandbox.exec(command)49return {50"stdout": result.stdout,51"stderr": result.stderr,52"exit_code": result.exit_code53}54```5556The agent now uses `grep`, `cat`, `find`, and `ls` to navigate YAML, Markdown, and JSON files containing dimension definitions, measure calculations, and join relationships.5758### Comparative Results5960| Metric | Original (17 tools) | Reduced (2 tools) | Change |61|--------|---------------------|-------------------|--------|62| Average execution time | 274.8s | 77.4s | 3.5x faster |63| Success rate | 80% (4/5) | 100% (5/5) | +20% |64| Average token usage | ~102k tokens | ~61k tokens | 37% fewer |65| Average steps | ~12 steps | ~7 steps | 42% fewer |6667The worst case in the original architecture: 724 seconds, 100 steps, 145,463 tokens, and a failure. The reduced architecture completed the same query in 141 seconds with 19 steps and 67,483 tokens, successfully.6869## Why Reduction Works7071### File Systems Are Powerful Abstractions7273File systems have 50+ years of refinement. Standard Unix tools like `grep` are well-documented, predictable, and understood by models. Building custom tools for what Unix already solves adds complexity without value.7475### Tools Were Constraining Reasoning7677The specialized tools were solving problems the model could handle on its own:78- Pre-filtering context the model could navigate79- Constraining options the model could evaluate80- Wrapping interactions in validation logic the model didn't need8182Each guardrail became a maintenance burden. Each model update required recalibrating constraints. The team spent more time maintaining scaffolding than improving the agent.8384### Good Documentation Replaces Tool Sophistication8586The semantic layer was already well-documented:87- Dimension definitions in structured YAML88- Measure calculations with clear naming89- Join relationships in navigable files9091The custom tools were summarizing what was already legible. The model needed access to read the documentation directly, not abstractions on top of it.9293## Implementation Pattern9495### The File System Agent9697```python98from ai import ToolLoopAgent, tool99from sandbox import Sandbox100101# Create sandboxed environment with your data layer102sandbox = Sandbox.create()103await sandbox.write_files(data_layer_files)104105# Single primitive tool106def create_execute_tool(sandbox):107return tool(108name="execute_command",109description="""110Execute a bash command in the sandbox environment.111112Use standard Unix tools to explore and understand the data layer:113- ls: List directory contents114- cat: Read file contents115- grep: Search for patterns116- find: Locate files117118The sandbox contains the semantic layer documentation:119- /data/entities/*.yaml: Entity definitions120- /data/measures/*.yaml: Measure calculations121- /data/joins/*.yaml: Join relationships122- /docs/*.md: Additional documentation123""",124execute=lambda command: sandbox.exec(command)125)126127# Minimal agent128agent = ToolLoopAgent(129model="claude-opus-4.5",130tools={131"execute_command": create_execute_tool(sandbox),132"execute_sql": sql_tool,133}134)135```136137### Prerequisites for Success138139This pattern works when:1401411. **Documentation quality is high**: Files are well-structured, consistently named, and contain clear definitions.1421432. **Model capability is sufficient**: The model can reason through complexity without hand-holding.1441453. **Safety constraints permit**: The sandbox limits what the agent can access and modify.1461474. **Domain is navigable**: The problem space can be explored through file inspection.148149### When Not to Use150151Reduction fails when:1521531. **Data layer is messy**: Legacy naming conventions, undocumented joins, inconsistent structure. The model will produce faster bad queries.1541552. **Specialized knowledge is required**: Domain expertise that can't be documented in files.1561573. **Safety requires restrictions**: Operations that must be constrained for security or compliance.1581594. **Workflows are genuinely complex**: Multi-step processes that benefit from structured orchestration.160161## Design Principles162163### Addition by Subtraction164165The best agents may be the ones with the fewest tools. Every tool is a choice made for the model. Sometimes the model makes better choices when given primitive capabilities rather than constrained workflows.166167### Trust Model Reasoning168169Modern models can handle complexity. Constraining reasoning because you don't trust the model to reason is often counterproductive. Test what the model can actually do before building guardrails.170171### Invest in Context, Not Tooling172173The foundation matters more than clever tooling:174- Clear file naming conventions175- Well-structured documentation176- Consistent data organization177- Legible relationship definitions178179### Build for Future Models180181Models improve faster than tooling can keep up. An architecture optimized for today's model limitations may be over-constrained for tomorrow's model capabilities. Build minimal architectures that benefit from model improvements.182183## Evaluation Framework184185When considering architectural reduction, evaluate:1861871. **Maintenance overhead**: How much time is spent maintaining tools vs. improving outcomes?1881892. **Failure analysis**: Are failures caused by model limitations or tool constraints?1901913. **Documentation quality**: Could the model navigate your data layer directly if given access?1921934. **Constraint necessity**: Are guardrails protecting against real risks or hypothetical concerns?1941955. **Model capability**: Has the model improved since tools were designed?196197## Conclusion198199Architectural reduction is not universally applicable, but the principle challenges a common assumption: that more sophisticated tooling leads to better outcomes. Sometimes the opposite is true. Start with the simplest possible architecture, add complexity only when proven necessary, and continuously question whether tools are enabling or constraining model capabilities.200201## References202203- Vercel Engineering: "We removed 80% of our agent's tools" (December 2025)204- AI SDK ToolLoopAgent documentation205- Vercel Sandbox documentation206207208209210211