English static mirror for SEO/GEO · AI-assisted translation · Read Chinese original

Giving Language Models Hands and Nerves: An Engineering Playbook for Shipping AI Agents

Forum topic · ✨步子哥 · 2025-12-28

Summary

This Chinese tech-forum post is a practical engineering guide for building production-grade AI agents—autonomous systems that plan, call tools, act in environments, and iterate—rather than passive prompt-driven chatbots. It frames agent building as an engineering discipline: a 5-step Think–Act–Observe loop (mission, context scanning, planning, action, observation) implemented as a traceable state machine; a capability maturity scale from Level 0 (pure model) through Level 1 (tool-connected RAG/NL2SQL), Level 2 (strategic context engineering), Level 3 (multi-agent collaboration), to Level 4 (self-evolving systems). Core architecture is described as Model (brain), Tools (hands), Orchestration (nervous system), and Deployment (body), with guidance on model routing, function-calling contracts, memory, and HITL safeguards. It further covers Agent Ops (KPI-driven evaluation, LM-as-judge, Go/No-Go gates, OpenTelemetry tracing, human-feedback loops), A2A interoperability via Agent Cards and task-oriented communication, defense-in-depth security (policy engines, agent identity/SPIFFE, centralized gateway and registry), self-evolution via offline Agent Gyms, and a five-phase rollout roadmap. References include ReAct, Chain-of-Thought, τ-bench, and OpenTelemetry AI agent observability resources.

You can think of early generative AI as a highly gifted intern who can only sit at a desk and write: you give it a sentence, it returns a paragraph; you give it an image, it describes it. Impressive, but passive—every step needs a human watching, nudging, and correcting. What engineering teams actually want is a different form: autonomous systems that can plan on their own, call tools, act in an environment, and iterate continuously.

This is a hands-on guide for product managers, architects, and engineering teams: it takes “prompts” off center stage and focuses on deployable system design—a 5-step closed loop, Level 0–4 capability grading, core architecture (Model / Tools / Orchestration) plus deployment, Agent Ops, A2A interoperability, security and governance, self-evolution, and training environments.

Act 1: You're Building a System That Reliably Gets Things Done, Not a Smarter Model

The key to autonomous systems is not making the model more human-like, but placing the model inside a self-consistent loop: it makes plans from goals, calls external capabilities to fetch facts or execute actions, writes results back to state, and continues until the goal is met.

> Why is this mostly an engineering problem? Because in production, success is decided by: how context is assembled, how tools are wired in, how failures recover, how metrics are evaluated, how safety is enforced, and how everything is audited and traced. The model matters—it's the “brain”—but the system is the living organism.

A useful analogy: traditional developers are like bricklayers, hand-writing every logic step; agent developers are more like directors—set a constitution (system instructions and rules), cast actors (tools / sub-agents), stage scenes (context / memory / data), and continuously calibrate the show with operations (Agent Ops).

Act 2: The 5-Step Think–Act–Observe Loop

1. Get the Mission: receive a high-level goal (user request or trigger). 2. Scan the Scene: perceive the environment and gather context (short-term state, long-term memory, available tools, prior attempts). 3. Think It Through: the model plans in context (usually multi-step reasoning, not one-shot output). 4. Take Action: the orchestration layer selects and invokes tools / executes code / queries databases / triggers external actions. 5. Observe and Iterate: write tool results back into context and return to step 3, looping until the task is done.

Example: a customer asks “where is order #12345”. The system shouldn't guess—it should plan: query the internal order system → get the tracking number → call the carrier's API → summarize and reply. Each tool call produces an Observation, which becomes the input for the next Think.

Engineering essentials: the loop is a “state machine + traceable trajectory,” not just multi-turn chat

  • Record (Action, Observation) every round, forming a replayable execution trajectory.
  • Every step is observable: logs, metrics, traces—not “the model's own account.”
  • Policy/safety callbacks around tool calls (block dangerous parameters, force human confirmation).
  • Failure recovery: timeouts, permission errors, empty retrieval, flaky external APIs all need retry / degradation / fallback paths.
  • Act 3: Level 0–4 Grading — Don't Build a “Super Agent” on Day One

    Grading forces you to answer “what level are we targeting?” at project kickoff, preventing scope creep.

  • Level 0: Core Reasoning (pure model) — no tools, no memory, no knowledge of events after training. Fine as an explainer, writer, or planner; not for production tasks accountable to facts.
  • Level 1: Connected Problem-Solver — calls external tools: Search, RAG (vector DB / knowledge graph), NL2SQL, business APIs. Core value: “look it up first,” anchoring facts to authoritative sources and significantly reducing hallucination. Recommendation: most enterprises' first production agent should be Level 1.
  • Level 2: Strategic Problem-Solver — the key capability is context engineering: automatically constructing the most focused context and queries for the next reasoning/tool step, rather than blindly stuffing information (e.g., find the midpoint between two locations first, then query places near it rated 4+ stars). The agent is a curator of the context window: assemble context → call model → observe → reassemble.
  • Level 3: Collaborative Multi-Agent — shift from “one all-rounder” to a team of specialists: an orchestrator decomposes tasks and dispatches to research / writing / coding / compliance agents, then aggregates results. Suits parallelizable tasks, critique-and-rewrite loops, and long-running work.
  • Level 4: Self-Evolving — the system identifies capability gaps and dynamically creates new tools or agents. Powerful, but expands the permission surface, attack surface, and unpredictability—demanding stronger policy and audit controls.
  • Act 4: Core Architecture — Brain, Hands, Nervous System, and Body

    A production-ready agent typically has four layers:

  • Model (brain): reasoning and decision-making
  • Tools (hands): fetching information and performing actions
  • Orchestration (nervous system): driving Think–Act–Observe, managing state and policy
  • Deployment (body and legs): making it a reliable service (monitoring, logging, admin, scaling, interfaces)
  • Model: pick the brain that fits the loop, not the top benchmark score

    Production needs multi-step reasoning stability, reliable tool use, and controlled cost/latency—otherwise ROI collapses.
  • Model routing: strong models for critical planning and hard reasoning; fast models for high-frequency light tasks (intent classification, summarization, formatting). Make models replaceable modules and keep comparing new models with an evaluation pipeline.
  • Multimodal: use natively multimodal models (simpler pipeline) or convert vision/speech to text with specialized models first (more flexible, more complex).
  • Tools: auditable “hands” with contracts

    Tools split into fetching information and performing actions.
  • Fetching: RAG (“a library card for the system”), vector DBs, knowledge graphs, NL2SQL for structured data (sales, inventory, ticket stats). Goal: anchor answers to real-world data, reduce hallucination.
  • Acting: sending email, creating calendar events, updating ticket systems, writing and running code (always sandboxed). This is a qualitative leap from “read” to “do”; high-risk actions should include Human-in-the-Loop (confirmation, clarification, approval).
  • Function calling: whether OpenAPI, MCP, or custom schemas, contracts should have (1) clear parameter types/ranges/defaults, (2) clear response structures/error codes/retry semantics, (3) built-in guardrails—reject unauthorized or dangerous requests outright, not “depending on the model's mood.”
  • Orchestration: the nervous system decides whether you have a controllable system or random chat

    Responsibilities: when to reason vs. call tools; plan decomposition and execution order; state and memory management; reasoning strategy selection (e.g., ReAct-style coupling of reasoning and action).
  • Autonomy spectrum: deterministic workflows (the LM is just one step) to LM-driven dynamic execution.
  • Implementation: no-code (fast) vs. code-first frameworks (controllable, maintainable).
  • Production frameworks must be pluggable (replaceable models/tools), governable (hard-coded rules constraining non-determinism), and observable (traceable, replayable trajectories).
  • Memory: short-term = the Action/Observation trajectory; long-term = cross-session persistence, usually implemented as “memory tools” via RAG/search, with the orchestrator prefetching and actively querying.
  • Deployment: making the agent actually walk

    Production deployment must handle: secure hosting and horizontal scaling; session history and memory persistence; monitoring, logging, admin, audit; and serving both UIs and other agents (A2A). Start with integrated platforms to validate quickly; for production, add CI/CD, automated evaluation, canary releases, and rollback.

    Act 5: Agent Ops — Taming Randomness with Experiments and Observability

    Traditional unit tests can't assert output == expected on a probabilistic system. Agent Ops turns unpredictability into a measurable, comparable, iterable engineering object.
  • Measure what matters: start from business KPIs—task completion rate, user satisfaction, latency, unit cost, impact on revenue/conversion/retention.
  • LM Judge: replace pass/fail with rubric-based quality scoring (correctness, grounding in retrieved facts, instruction/tone/format compliance). Build eval sets from real interactions, covering main paths and edge cases; have domain experts periodically spot-check and calibrate.
  • Metrics-driven development: run the full eval set on every change, compare quality scores against production, plus latency, cost, and success rate; ship risky changes via A/B canary with Go/No-Go gates.
  • OpenTelemetry traces: record the actual prompt, chosen tool, generated parameters, raw tool responses, and per-step latency/errors—for root-cause analysis, not pretty dashboards.
  • Human feedback: turn bad reviews into vaccines—collect → reproduce → fix → add to the eval set.
  • Act 6: Interoperability — Agents Are Not Tools; A2A Is the Ecosystem Language

    Tools are transactional capability calls; agents are entities that decompose problems, plan, and collaborate. Conflating the two leads to brittle, unscalable integrations.
  • Agent Card: a JSON “business card” declaring capabilities, endpoints, and required credentials—solving discovery.
  • Task-oriented communication: asynchronous task interaction with streaming progress updates, suited to long tasks and multi-agent collaboration.
  • Without standardized interop, multi-team or multi-agent systems quickly become “custom-API spaghetti.”

    Act 7: Security and Governance — A Longer Leash, But Keep It Out of Traffic

    Risks come from both unauthorized actions and sensitive data leakage, plus attacks like prompt injection. Don't rely on the model's “self-discipline.”
  • Defense-in-depth: hard rules (external policy engines blocking high-risk actions—amount thresholds, API allowlists, mandatory confirmation) + intelligent review (small guard models screening inputs/outputs/plans at runtime for injection, privilege escalation, dangerous content).
  • Agent identity: treat agents as a third class of principal in IAM, issue verifiable identities (e.g., SPIFFE-based), and grant least privilege—so even a compromised agent has a contained blast radius.
  • Policies: cover agents, tools, sub-agents, context sharing, and remote agents—not just “can it call this API” but which data it can access, what context it can send out, and which external agents it can invoke.
  • Framework security practices: clear boundaries between user identity, runtime identity, and agent identity; enforce policy inside tools (reject unauthorized parameters); callback/plugin-style pre-call checks (parameter validation, state consistency); optionally plug in managed safety layers (prompt injection, PII, malicious URL filtering).
  • Enterprise scale — control plane against “agent sprawl”: a centralized gateway as the entry point for all agent traffic (user→agent, agent→tool, agent→agent, inference calls), providing runtime AuthN/AuthZ with unified audit and a single pane of glass for logs/metrics/traces—plus a registry (like an enterprise app store) for asset discovery/reuse, security review, versioning, and fine-grained authorization.
  • Act 8: Self-Evolution and Training Grounds — Avoiding System “Aging”

    Reality changes: policies, data formats, business processes, external APIs. Systems that can't adapt age.
  • Learning signals: runtime trajectories (logs, traces, memory, success/failure cases); human feedback (especially corrections on critical decisions); new external material (regulations, updated docs, critiques from other agents).
  • Two practical adaptation routes: continuously refine context engineering (prompts, few-shots, retrieval strategies, memory recall); optimize and create tools (add new tools, generate scripts, update schemas).
  • Agent Gym (offline training ground): move exploration and stress testing off the production path—trial-and-error in simulated environments, synthetic data and red-team stress tests, more tools and stronger models allowed, with domain experts calibrating “correct results” on edge cases.
  • Act 9: Lessons from Advanced Systems (Co-Scientist / AlphaEvolve style)

  • Research-collaboration systems show that when the task space is huge and requires long exploration, the most effective form is often multi-agent collaboration plus continuous evaluation and improvement.
  • Evolutionary-optimization systems show that when you can build a strong evaluator (verification is easier than discovery), autonomous systems can do large-scale search and iterative optimization—but the metric must be rigorously human-defined to prevent reward hacking.
  • An Actionable Roadmap (Engineering View)

    Phase 1: Start at Level 1 — get the loop and tool contracts working

  • Define mission types and KPIs
  • Connect authoritative sources (RAG / NL2SQL / business APIs)
  • Record replayable (Action, Observation) trajectories
  • Tool contracts + error semantics (retry / degradation / timeout)
  • Phase 2: Level 2 — engineer context and memory

  • Design context-assembly strategies (minimal sufficient information)
  • Short-term trajectory + long-term memory tools
  • Introduce HITL for high-risk actions
  • Phase 3: Level 3 — multi-agent teams

  • Orchestrator + specialist agent division of labor
  • Separate generation and critique into an iterative rewrite loop
  • Introduce A2A: Agent Card + task communication
  • Phase 4: Productionize and govern (Agent Ops + security control plane)

  • Eval sets + LM Judge rubrics
  • Go/No-Go gates and canary A/B
  • End-to-end OpenTelemetry traces
  • Agent identity, policy engines, in-tool guardrails, dynamic safety checks, optional managed safety layers
  • Gateway + registry to govern sprawl
  • Phase 5: Explore Level 4 and offline training grounds (cautiously)

  • “Create tools / create agents” capabilities must be policy-constrained and auditable
  • Do learning and red-teaming offline; feed stable improvements back into production

References

1. Shunyu Yao, et al. (2022). *ReAct: Synergizing Reasoning and Acting in Language Models*. https://arxiv.org/abs/2210.03629 2. Wei, J., Wang, X., et al. (2023). *Chain-of-Thought Prompting Elicits Reasoning in Large Language Models*. https://arxiv.org/pdf/2201.11903.pdf 3. Shunyu Yao, et al. (2024). *τ-bench: A Benchmark for Tool-Agent-User Interaction in Real-World Domains*. https://arxiv.org/abs/2406.12045 4. Guangya Liu, Sujay Solomon (2025). *AI Agent Observability - Evolving Standards and Best Practice*. https://opentelemetry.io/blog/2025/ai-agent-observability/ 5. Deepak Nathani, et al. (2025). *MLGym: A New Framework and Benchmark for Advancing AI Research Agents*. https://arxiv.org/abs/2502.14499

Tags

#ai-agents#llm#agentic-architecture#agent-ops#rag#multi-agent-systems#a2a#security-governance

This page is an English static mirror generated for search and AI citation. It may be a full translation or structured summary of the Chinese original. Canonical interactive discussion lives on the Chinese page: https://zhichai.net/topic/176415194