Six Principles for Building Production AI Agents
app.build · Tech · 2025 · source Agentic: yes · promotional bias: med · summary-only (no fetched source) · extracted with prompt 0.5.6 (schema v2)
Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.
Problem
Domain: Production software-engineering agents
App.build needed production AI agents that generate and maintain software reliably, recover from failures, and improve through systematic feedback rather than relying on model capability alone.
Constraints:
- Agents need enough context to avoid hallucination but long contexts cause cost and attention problems.
- Ambiguous tools can be misused by LLMs more easily than by human developers.
- Software-generation agents need objective validation loops for code, tests, types, and linting.
- Large volumes of agent logs require systematic error analysis rather than ad-hoc debugging.
Architecture
App.build frames production agents as engineered systems: detailed system prompts establish behavior, context is split between minimal initial knowledge and tools for dynamic retrieval, tools are typed and simple, actor components generate or modify code, critic components validate against compilation/testing/type/lint gates, failure recovery decides repair versus retry, observability records trajectories, and large-context LLMs analyze logs for recurring design issues.
Diagram confidence: reconstructed (reconstructed from prose).
flowchart LR A["System prompt"] --> C["Agent runtime"] B["Context manager"] --> C L["Context compaction tools"] --> B C --> D["Simple typed tools"] D --> E["Codebase"] C --> F["Actor component"] F --> G["Critic component"] E --> H["Validator suite"] H --> G G --> I["Failure recovery"] I --> J["Trajectory logs"] J --> K["LLM error analysis"] K --> A K --> B K --> D
Components
| Component | Role | Interacts with |
|---|---|---|
System prompt |
Detailed instruction layer refined for production behavior. | Agent runtime |
Context manager |
Splits static prompt context from dynamic tool-fetched context and compacts logs/feedback. | Agent runtime, Context compaction tools |
Agent runtime |
Software engineering agent that reads context, calls tools, and generates code or changes. | System prompt, Context manager, Simple typed tools, Actor component |
Simple typed tools |
Limited, idempotent tool interfaces such as read_file, write_file, edit_file, and execute. | Agent runtime, Codebase |
Codebase |
Software project being generated, modified, and validated. | Simple typed tools, Validator suite |
Actor component |
Creative code-generation or modification loop. | Agent runtime, Critic component |
Critic component |
Strict review loop that evaluates outputs against handcrafted criteria and validators. | Actor component, Validator suite, Failure recovery |
Validator suite |
Compilation, testing, type checking, and linting feedback mechanisms. | Codebase, Critic component |
Failure recovery |
Hard and soft failure handling that repairs, discards, or retries work. | Critic component, Trajectory logs |
Trajectory logs |
Observed agent behavior and failures for systematic analysis. | Failure recovery, LLM error analysis |
LLM error analysis |
Large-context LLM analysis of logs to find context/tool/prompt blind spots. | Trajectory logs, System prompt, Context manager, Simple typed tools |
Context compaction tools |
Automatic management of logs and feedback artifacts that bloat context windows. | Context manager |
Data flow
The agent begins with a refined system prompt and compact context, calls simple typed tools such as file read/write/edit/execute, produces code or changes through an actor loop, sends outputs through critics and validators, records trajectory logs, and uses LLM-assisted meta-analysis to find recurring failures and improve prompts, context, tools, and guardrails.
3 supporting quotes
Why this architecture
The architecture treats agents as recoverable production systems rather than one-shot model calls: prompts, context, tools, validators, feedback loops, and meta-analysis all compensate for different failure modes.
3 supporting quotes
Models used: Claude · Gemini 1M context · Deep Research-like LLM variants
Scale
- Most software engineering agents use fewer than ten multifunctional tools.“Most of their software engineering agents use fewer than ten multifunctional tools with one to three parameters each”summary, stated
- App.build uses LLMs with Gemini's 1M context capability for log analysis.“analyzing them using LLMs with large context windows (specifically mentioning Gemini's 1M context capability)”summary, stated
- The system generates large volumes of logs from dozens of concurrent agents.“The company's ability to generate "tons of logs" from dozens of concurrent agents suggests successful scaling of their production systems.”summary, stated
Alternatives considered (roads not taken)
Treat prompt engineering as manipulation or tricks
Rejected because: App.build found direct, detailed system instructions important for modern production models.
Give all context up front
Rejected because: Long contexts increase cost and attention attrition, so App.build exposes only essentials initially and fetches more through tools.
Let agents call broad ambiguous APIs
Rejected because: LLMs misuse ambiguous interfaces, so tools are kept typed, limited, and idempotent.
Patterns
prompt-versioning (prompting)
The system prompt is treated as a production artifact that receives investment, bootstrapping, and human refinement.
context-engineering (agent-context)
App.build controls what enters context, fetches additional context dynamically, and compacts logs and feedback artifacts.
tool-use-orchestration (agent-architecture)
Agents use a small set of simple, typed, idempotent tools rather than broad ambiguous APIs.
eval-driven-development (evaluation)
Actor-critic loops validate generated software with compilation, tests, type checks, and linting.
observability-tracing (observability)
Trajectory logs and LLM-assisted analysis surface recurring agent behavior and failure patterns.
Tradeoffs
Expose fewer multifunctional tools.
Chose fewer than ten simple tools with one to three parameters over large tool surfaces with ambiguous APIs.
Rationale: Smaller tool surfaces reduce misuse and state-management complexity.
Separate actor creativity from critic strictness.
Chose actor-critic validation loops over single-pass generation without validation.
Rationale: Software engineering has objective validators that can safely constrain creative generation.
Treat failure as recoverable.
Chose hard and soft recovery strategies over expecting perfect first-pass agent behavior.
Rationale: Production agents need repair, discard, and retry paths depending on severity.
Gotchas (what bit them)
Long context can create both cost and attention failures.
Root cause: Stuffing all project information into the prompt bloats context and can distract the model.
Resolution: Provide essential context initially and expose tools for fetching relevant details on demand.
Ambiguous tools cause agent misuse.
Root cause: LLMs are more likely than humans to misuse unclear interfaces or exploit loopholes.
Resolution: Design tools with consistent granularity, strict types, limited parameters, and idempotency.
Agent failures can be misdiagnosed as model limitations.
Root cause: Missing API keys, permissions, or tool access can look like bad model behavior.
Resolution: Debug system configuration and tool availability before blaming the model.
Manual log review does not scale with concurrent agents.
Root cause: Dozens of agents generate large volumes of trajectory logs.
Resolution: Use large-context LLMs to categorize failures and identify blind spots in context and tools.
Evaluation
App.build evaluates agents through validator feedback loops, trajectory-log observability, baseline comparisons, LLM-assisted error analysis, and systematic categorization of failure modes.
Metrics: compilation success · test results · type checking · linting · failure category · recovery success · trajectory patterns
Outcomes
- App.build derived six production-agent principles from operating software-engineering agents.
- Their systems generate enough logs from dozens of concurrent agents to support systematic error analysis.
- The case study emphasizes reliable, recoverable agents over perfect behavior.
The source lacks concrete business metrics, but it cites dozens of concurrent agents, large trajectory logs, and Gemini 1M-context log analysis.