跪拜 Guibai
← All articles
Agent · Artificial Intelligence

Agent Development Blueprint: From Prompts to Autonomous Digital Employees

By vivo互联网技术 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Production agent developers get concrete defaults and failure-mode mitigations—from compaction thresholds to permission states—that eliminate the trial-and-error phase, and the guide's insistence on human-in-the-loop and sandboxing clarifies where autonomy is still bounded by trust, not model capability.

Summary

The guide traces the progression from single-shot LLM calls to autonomous agents, framing each step as a response to a previous failure: prompt engineering controls output distribution, RAG brings in external knowledge without fine-tuning, and Harness engineering supplies the runtime infrastructure—state, compression, error handling, observability—that keeps a ReAct loop running reliably. The ReAct loop becomes the core control structure, where reasoning and tool use interleave so the agent can adjust plans from observations; tool calls, memory, and knowledge bases each connect to that loop.

The practical section is the densest part. It walks through four canonical scenarios—knowledge Q&A, code engineering, data analysis, and multi-agent R&D pipelines—and then lists the five pain points that sink real deployments: tool mis-selection from vague descriptions, context explosion from unmanaged token growth, infinite loops without iteration caps, security breaches without permission gates and sandboxes, and evaluation difficulty in non-deterministic systems. Concrete fixes are given with config fragments: compaction at 20 messages, maxIters of 10, strict permission modes, Redis state stores, and small models for memory ops to cut cost by 40-60%.

Takeaways
— ReAct interleaves reasoning and action; the LLM sees each prior Thought, Action, and Observation, so it can dynamically revise its plan from tool results.
— Compaction should trigger early: 20 messages is recommended over 50, and only the latest 8 messages plus a summary are kept.
— Tool descriptions drive LLM selection; they must be detailed, include input/output formats, and avoid overlapping responsibilities.
— An Agent instance is stateless; all state is externalized by user and session ID, and Redis-based state stores enable cross-machine failover and zero-downtime rolling releases.
— maxIters defaults to 10 and should always be set in production to prevent token-burning infinite loops.
— Memory flush operations can use a cheaper model (e.g., qwen-turbo) and throttle to every 10 minutes, cutting memory management cost by up to 80%.
— For data analysis Agents, SQL tools must use read-only database accounts and Python execution must run in a sandbox.
— The production deployment checklist includes STRICT permission mode, toolResultEviction for large results, event-stream observability, fallback models, and privacy masking of sensitive tool returns.
— Model routing splits work between a strong main model and cheap auxiliary models, lowering overall cost by 40-60% with almost no quality loss.
— Skills are Markdown instruction sets that accumulate successful workflows; general skills go to a Git repo, project-specific ones into the workspace, and personal ones are user-isolated.
Conclusions

The article treats each architectural advance as a patch for a concrete failure of the previous layer, which makes the whole stack feel like a debugging trail more than a theoretical taxonomy.

The recommendation to always set a low compaction threshold and cap iterations shows that Agent reliability is engineered around the LLM's tendency to drift or loop, not around its reasoning quality.

Placing permission rules and task lists inside AgentState alongside conversation history is a subtle but important point: state that affects reasoning must be visible to the model, not just stored in the framework.

The guide's insistence on HITL and read-only-first validates the view that agent autonomy in production is a gradual release of trust, not a binary switch.

The cost-saving guidance to route memory and compaction to small models suggests that in real deployments, the marginal value of a strong model is concentrated in the main reasoning steps, not in the peripheral infrastructure.

Concepts & terms
ReAct
A control pattern that interleaves reasoning (Thought), tool invocation (Action), and observation (Result) in a loop, letting an LLM dynamically adjust its plan based on what tool calls return.
RAG (Retrieval-Augmented Generation)
A technique that retrieves relevant document chunks from an external knowledge base using vector similarity, then includes them in the prompt so the LLM answers from factual sources instead of its parametric memory.
Harness Engineering
The runtime infrastructure for autonomous agents—state persistence, context compression, error handling, and middleware—that keeps a ReAct loop running reliably over long sessions.
MCP (Model Context Protocol)
A standardized protocol that decouples tool providers from agent frameworks; a tool server exposes its function list, and any MCP-compatible agent can discover and call them, analogous to HTTP for web services.
Function Calling
The mechanism where an LLM outputs a structured tool_call instruction (name and arguments) instead of plain text; the framework then executes the corresponding function and returns the result to the model.
Chain-of-Thought (CoT)
A prompting technique that forces the model to write out intermediate reasoning steps, effectively breaking a high-entropy input-to-output mapping into lower-entropy incremental steps, reducing per-step error.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗