Agent Development in Practice: A Guide to Building a Chinese-Language Handbook

    This article explains how to build a logically consistent and executable Chinese-language handbook for AI agent development that serves as an engineering asset. It covers a five-layer structure spanning concepts, capabilities, implementation, evaluation, and operations, along with capability boundaries and permission design, prompt and tool orchestration, context and memory management, an evaluation system with offline test cases and regression gates, and gray-release operations. Developers will find practical conventions, sample pseudocode, and a pre-launch checklist for delivering agent capabilities reliably and at controlled cost.

    1. Why You Need a Chinese-Language Agent Handbook

    In real-world development, agent projects often fail not because the model lacks capability, but because there is no document that fixes the design intent, capability boundaries, and operational conventions. The source material points to a class of Chinese-language reference resources aimed at developers: it organizes scattered experience into entries that can be consulted on demand. Setting aside specific product attributes, this article discusses a general question—how to build a logically consistent and executable agent development handbook in Chinese, and make the handbook itself an engineering asset.

    The handbook addresses three typical pain points. First, stakeholders and implementers have inconsistent understandings of what the agent can actually do. Second, prompts, tool calls, and business rules are scattered across the codebase and hard to review. Third, there is no evaluation baseline after launch, so problems cannot be attributed. The value of the handbook lies in making these implicit conventions explicit.

    2. Overall Structure: The Five-Layer Model

    Organize content into five layers, with a one-way dependency between layers to avoid overlapping concepts.

    1. Concept layer: Define unified terms such as agent, tool call, context window, and evaluation set, to avoid the same term meaning different things within the team.
    2. Capability layer: Describe input modalities, executable actions, permission scope, and refusal policies to form a capability list.
    3. Implementation layer: Coding conventions for prompt organization, tool registration, state management, and error recovery.
    4. Evaluation layer: Offline cases, regression baselines, manual sampling ratio, and pass thresholds.
    5. Operations layer: Log fields, monitoring metrics, alert thresholds, and gray-release and rollback procedures.

    3. Capability Boundaries and Permission Design

    The handbook must include a section specifically on “what it does not do.” A capability matrix table can be used, with business scenarios on the horizontal axis and allowed action types (read-only query, write, external side effect) on the vertical axis, marking cell by cell whether an action is allowed and whether secondary confirmation is required. For actions involving funds, data deletion, or external sending, explicitly require confirmation and an idempotency key.

    Sample configuration (pseudocode):

    1. CAPABILITY = {
    2. "query_order": {"actions": ["read"], "confirm": False},
    3. "refund": {"actions": ["write", "side_effect"], "confirm": True},
    4. }
    5. def guard(tool, ctx):
    6. rule = CAPABILITY.get(tool, {"actions": [], "confirm": True})
    7. return rule["actions"] and (not rule["confirm"] or ctx.confirmed)

    4. Prompt and Tool Orchestration

    Split the prompt into four parts: role and goal, available tool descriptions, constraints and refusal rules, and output format. Tool descriptions should clearly state parameter meanings, failure return structures, and retry suggestions to prevent the model from fabricating parameters. For orchestration, follow the principle of “plan first, then execute, with each step verifiable,” exposing only the necessary tools at each step to reduce incorrect calls.

    1. [Goal] Locate order status based on the user's question
    2. [Tool] order_status(order_id: str) -> {state, updated_at, error?}
    3. [Constraint] Ask for order_id first if it is missing; if error is non-empty, report it truthfully and do not fabricate
    4. [Output] JSON: {"answer": str, "used_tools": list}

    5. Context and Memory Management

    Context is a limited resource, so the handbook must define a priority order: system constraints > current user instruction > retrieved snippets > historical summary. Use layered summarization for history, compressing it into key points when it exceeds the window; long-term memory stores only structured facts with timestamps, making them easy to invalidate and correct. Retrieved snippets must be labeled with source and update time; when conflicts occur, the more recent and authoritative source prevails.

    6. Evaluation System: Making Quality Measurable

    First build an offline case set of no fewer than one hundred entries, covering four categories: normal paths, boundary inputs, unauthorized requests, and tool failures. Suggested metrics include task success rate, parameter accuracy, unauthorized-request interception rate, and average number of steps. Run a regression on every prompt or tool description change, set a pass threshold, and prohibit launching based on intuition.

    Case Type Focus Example Pass Threshold
    Normal path Correct answer, concise steps Success rate ≥ baseline
    Boundary input Follow-up and clarification No fabricated parameters
    Unauthorized request Interception and notification 100% interception rate
    Tool failure Truthful reporting and retry No fabricated results

    7. Launch and Operations

    Use gray release and shadow traffic in parallel: the new version first only logs without taking effect, then traffic is increased after comparing key metrics. Logs use unified fields (session identifier, tool name, latency, error code, whether confirmed), with sensitive information masked. Monitoring covers latency, failure rate, tool exception rate, and refusal rate, with alerts bound to on-call staff and a rollback switch. You can use Baidu AI Cloud’s general-purpose log service, monitoring and alerting, and object storage to handle data retention and build dashboards, while keeping a vendor-agnostic interface abstraction.

    8. Common Pitfalls and Checklist

    Pitfalls include: treating the prompt as the only control mechanism, vague tool descriptions, missing refusal policies, an evaluation set that is not updated over time, and logs lacking a correlation identifier. Confirm each item before launch: whether the capability matrix has been reviewed; whether every write operation has confirmation and idempotency; whether the evaluation meets the threshold; whether rollback has been rehearsed; whether masking is in effect.

    9. Conclusion

    A qualified Chinese-language agent handbook is essentially an engineering specification that writes capability boundaries, implementation conventions, and quality thresholds into something reviewable and regression-testable. Proceed with the five-layer structure, converge on boundaries before discussing effectiveness, and combine continuous evaluation with gray-release operations, so the team can deliver agent capabilities reliably at controlled cost.