Office Hours — What patterns and practices have you found most effective for agentic AI workflows in production systems?
A daily developer question about AI/LLMs, answered with a direct, opinionated take.
What patterns and practices have you found most effective for agentic AI workflows in production systems?
The honest answer is that most teams are still figuring this out, but a few concrete patterns are emerging from actual deployments rather than benchmarks.
Verification is Everything
The biggest lesson from production failures is that agents need fast, objective feedback loops. When an agent can immediately tell if it succeeded (test passes, linter completes, curl request returns 200), it works reliably. When success is ambiguous, it drifts. This is why coding agents work reasonably well but general research or decision-making agents still require human checkpoints.
Build a tight observation loop first. Before you orchestrate complex agentic workflows, instrument your system so the agent gets real-time signal on whether each action moved toward the goal. Test pass/fail is gold. An HTTP status code is gold. “Did the document analysis make sense?” is not gold and will waste tokens.
Deterministic Fallbacks Beat Retry Logic
When an agent encounters an ambiguous situation, retrying the same decision loop just wastes tokens. Instead, fall back to a deterministic rule or escalate to a human decision boundary.
A concrete example from production RAG-agent systems: if an agent’s retrieval confidence drops below a threshold, don’t ask it to try again. Hand off to a database query or a keyword search. If the confidence is still low, fail gracefully rather than generate plausible-sounding hallucinations.
def agent_with_fallback(query, agent, deterministic_handler):
try:
result = agent.execute(query, max_retries=1)
if result.confidence < 0.7:
return deterministic_handler(query)
return result
except AgentError:
return deterministic_handler(query)
This pattern—try agent-driven reasoning, fall back to deterministic logic on ambiguity—is shipping at scale. It’s not glamorous, but it’s what’s actually working in financial services, logistics, and code generation.
Memory and Context as First-Class Infrastructure
Production agents fail silently when context gets stale or when they lose track of what they’ve already tried. Treat memory like you’d treat a database: with explicit schema, versioning, and cleanup.
The semantic layer (from the Daily Signal last week) matters here. Agents need to understand business logic through a consistent interface. If your agent can’t reliably interpret “what does ‘customer churn’ mean in this context,” it will make mistakes that look like hallucinations but are actually context failures.
Implement an operational memory layer that’s separate from the main prompt. Use structured logging that the agent can query, not freeform conversation history. Version your context explicitly so you can debug what the agent actually saw when it made a decision.
Cost Control Through Token Budgets, Not Retries
The token mindset (Daily Signal July 17) is real: your actual budget explodes when you’re not counting context carefully. In agentic workflows, this gets worse because each agent step can compound.
Set a hard token budget per task and enforce it before executing, not after. Gemini 3.5 Flash is fast and cheap, but if your agent can make 10 tool calls per task and you’re not enforcing a budget, you’ll burn through your monthly bill on a single production incident.
budget = TokenBudget(max_input=5000, max_output=2000)
for step in agent_loop:
if budget.remaining < step.estimated_cost:
agent.escalate_to_human()
break
result = agent.step()
budget.charge(result.tokens_used)
Orchestration Matters More Than Model Choice
The Daily Signal coverage of Sakana’s Fugu orchestrator (July 16) highlights something that’s often buried: how you route work between models and tools beats which single model you pick. A smaller, faster model routed to the right task will outperform a bigger model doing everything.
In production, you’re not running a single frontier model. You’re composing specialized models: a fast classifier to decide if a query needs deep reasoning or just lookup, a small embedding model for retrieval, Claude Opus for complex reasoning, Gemini Flash for code, a deterministic parser for structured extraction.
This means your agentic architecture should have explicit routing logic. Don’t let Claude Opus handle every step if you can route simple classification to a smaller model and save 10x on tokens.
Security and Tool Access as Hard Constraints
The Daily Signal (July 17) coverage of agentic AI security isn’t alarmist. If your agent has API keys, file system access, or database permissions, assume it will misuse them under pressure or confusion. Encryption and isolation matter.
Enforce tool access through a capability-based security model. Your agent shouldn’t have a key to every database; it should have a set of pre-approved queries it can run. It shouldn’t have write access to production; it should have a staging environment and a human approval step before production deploys.
This sounds bureaucratic, but it’s the difference between an agent that occasionally makes mistakes and an agent that can accidentally corrupt production data or leak credentials.
Evaluation Isn’t Optional
You can’t ship agents without measuring them on your actual workload. Benchmark theater (Hugging Face, July 17) means nothing for your specific problem.
Build lightweight evaluation from day one. A few examples: for coding agents, count passing tests before and after. For extraction agents, score extraction accuracy against human-annotated samples. For search agents, measure retrieval precision at retrieval time, not hallucination-ness of the final response.
Tools like Promptfoo and RAGAS are table stakes. Run these automatically on every model version change and on a sample of production traffic. You’ll catch drift before customers do.
Agentic RAG Works When Retrieval is Verifiable
RAG-as-an-agent-tool (rather than a retrieval-in-the-prompt pattern) works well when you can verify whether the retrieval step actually found relevant documents. This means storing relevance scores, tracking retrieval precision, and failing fast when confidence is low.
The anti-pattern is agents that silently hallucinate when retrieval fails. The pattern is agents that recognize failure and escalate. This requires explicit evaluation of retrieval quality at runtime, not just as a post-hoc check.
Concrete Stack Today
If you’re starting now, this is what’s actually working:
Coding agents: GitHub Copilot or Claude Code (both now stable in production, with Opus 4.8 or GPT-5.6 Sol as the reasoning backbone). Databricks confirmed that open models (GLM-5.2) match Opus on their codebase while cutting costs.
General reasoning agents: Claude Opus 4.8 for complex tasks, Gemini 3.5 Flash for speed-sensitive tasks. Kimi K3 is emerging as a credible open alternative at competitive pricing.
Search and retrieval: Gemini 3.5 Flash (computer use, fast) or Claude Code (browser integration). For RAG, embed with NVIDIA’s Nemotron-3 Embed (tops the RTEB benchmarks).
Inference: vLLM for serious throughput, Ollama for simplicity. Inference engineering (FP8 KV cache, prompt caching, speculative decoding) is where your real cost savings live.
Bottom line: Build tight observation loops with fast objective feedback, route work intelligently rather than throwing everything at your biggest model, and treat security and cost as architectural constraints, not afterthoughts. The agents that work in production are the ones where you can verify success and fail gracefully when you can’t.
Question via Hacker News