Agent Protocols Enter Large-Scale Production: Six Engineering Challenges to Solve

    As agent tool protocols move beyond demos, this article breaks down six engineering problems that matter at scale—background tasks, structured user elicitation, layered skills, tool search, stateless design, and enterprise adoption—with design guidance and sample payloads.

    Agent Protocols Enter Large-Scale Production

    A recently disclosed set of industry numbers is worth a developer’s attention: roughly two years after its launch, one model context protocol (referred to below as MCP) has passed 700 million monthly downloads of its companion SDKs, and the number of connectors that can be invoked by AI coding tools and conversational agents has exceeded 10,000. The significance of these figures is not “popularity.” It is that invoking external tools from an agent has moved out of the demo stage and into large-scale engineering: the connector count reflects fragmentation on the tool supply side, while the download volume reflects diversity on the integration side. Put together, the real bottleneck is no longer “can we connect” but “once connected, how do we run a complete workflow stably, under control, and observably.”

    Using publicly disclosed capability evolution as the thread, this article abstracts six categories of engineering problems that agent tool protocols must solve at scale, along with design recommendations and sample code. Where cloud-side capabilities are involved, only generic categories are used, such as object storage, message queues, container platforms, logging services, and monitoring and alerting.

    1. From Synchronous Q&A to Long-Running Orchestration: Background Tasks and Callback Notifications

    Traditional tool invocation is synchronous: the model issues a call, waits for the response, and then continues reasoning. That works fine for short requests such as retrieval and lookups, but once a task takes tens of seconds or even minutes (batch data processing, report generation, full repository scans, document parsing), synchronous waiting has two consequences: context is occupied for a long time, and retrying after a failure is expensive.

    The core idea of the background tasks pattern is to decouple long-running execution from the conversation path: the server accepts a task and immediately returns a task identifier, executes it in the background, and notifies the caller through a notification mechanism when it finishes; the caller can keep doing other work while waiting. The engineering pieces that need to be filled in include:

    • Task identifiers and idempotency keys: to prevent duplicate submissions from producing duplicate side effects;
    • State machine definition: covering at least five states—accepted, running, succeeded, failed, and cancelled;
    • Result retrieval: a dual channel of callback notification plus active querying, with polling as a fallback if a callback is lost;
    • Timeout and cancellation semantics: a clear maximum server-side execution time and defined resource reclamation behavior after the caller cancels.
    1. {
    2. "task_id": "t-8f3c2a",
    3. "status": "running",
    4. "submitted_at": "2026-01-01T10:00:00Z",
    5. "estimated_seconds": 120,
    6. "result_uri": "resource://report/8f3c2a"
    7. }

    Note that background tasks shift the complexity onto state consistency. It is advisable to persist task state in a service with reliable storage semantics and to use a message queue to carry “completion events,” with an independent consumer responsible for callback delivery and retries, so that the execution process and the notification process stay decoupled.

    2. Letting a Task Stop and Ask a Human: The Elicitation Mechanism

    A common reason agents fail is not a lack of capability but missing input that gets filled in by a “reasonable guess.” The elicitation mechanism allows a task to pause mid-execution, ask the user structured clarifying questions, and continue once answers arrive.

    The key design point is to make the questions a controlled, structured interaction rather than free-text conversation:

    1. Every question must carry an explicit field definition (field name, type, allowed values, whether it is required), so the frontend can render and validate it;
    2. It must distinguish “skippable” from “must answer,” and define the degraded path taken when a question is skipped;
    3. Questions need a round limit and a merging strategy, so repeated follow-ups do not wreck the experience;
    4. Sensitive information (credentials, keys) should not be collected in plaintext through the conversation; it should be routed to a controlled authorization flow instead.
    1. {
    2. "interaction": {
    3. "type": "clarify",
    4. "fields": [
    5. {"name": "region", "type": "string", "required": true},
    6. {"name": "date_range", "type": "object", "required": false}
    7. ],
    8. "allow_skip": true,
    9. "max_rounds": 2
    10. }
    11. }

    Combined, background tasks and elicitation form a complete “interruptible and resumable” execution model: long tasks provide throughput, mid-task questions provide accuracy, and together they push the agent from “one-shot Q&A” toward “process executor.”

    3. Loading Knowledge and Workflows on Demand: Layered Skills and Context Budget

    When a server exposes a large number of tools and resources, injecting all the descriptions into context at once is neither economical nor reliable. The common industry practice is layered loading: inject a minimal tool index first, and fetch the specific descriptions only when the model decides it needs them; going further, separate “how to do the work” from “what capabilities can be called,” forming skill packages that load on demand.

    Skill packages are suited to content such as best-practice checklists, step-by-step workflows, operating conventions customized for a specific organization, and advice on avoiding common failure modes. Their engineering value is that they decouple domain knowledge from hardcoded prompts, allowing updates with server versions and differentiated delivery per tenant.

    The corresponding context budget can be quantified: assume N tokens of context are available in a single session, the tool index takes about 5%, and a full single-tool description takes about 3% to 8%. In a multi-server scenario, without optimization a dozen tools can consume more than half the budget. The goal of on-demand loading is to keep the resident footprint under 10% and leave the rest for business data and the reasoning process.

    4. Retrieval-Based Tool Discovery: Cutting Context Overhead Across Multiple Servers

    Tool search follows the same principle as retrieval-augmented generation: instead of keeping a full description for every tool resident in context, maintain searchable metadata (name, purpose summary, parameter schema, tags), recall a small set of candidates by semantics or keywords when needed, and then load their full descriptions.

    In complex environments that connect multiple servers, this kind of optimization saves context by an order of magnitude (public material states a reduction of more than 85%), with three direct benefits: the same context can hold more business information; tool selection accuracy improves, reducing wasted rounds spent picking the wrong tool and backing out; and adding a new server does not require rearranging prompts, so expansion costs drop significantly.

    Practical recommendations:

    • Store metadata and full descriptions separately, keeping metadata short and semantically clear;
    • Cap the recall count (for example, keep top-k at 3 to 5) to avoid secondary bloat;
    • Keep a resident whitelist for high-frequency tools, balancing latency and accuracy;
    • Record “recall misses” as input for improving metadata quality.

    5. Stateless Design and Stability: Externalizing Session State

    At scale, what servers fear most is being “stateful”: session stickiness, context lost when an instance restarts, and complex routing during scale-out. A stateless specification does not require the server to persist session data indefinitely; session state is carried by the caller or external storage, and the server only performs side-effect-free or idempotent processing.

    The benefits are obvious: services deployed on a container platform can scale up and down freely, rolling upgrades do not require session migration, and failure recovery only needs request replay. The cost is that consistency responsibility moves forward, so supporting pieces are needed: requests carry a complete context summary, critical operations use idempotency keys, and long-running task results land in object storage and are returned as references.

    6. Enterprise Adoption: Unified Authorization, Embedded UI, and Direct File Upload

    For organization-level use, three capabilities determine whether a rollout can actually take hold:

    • Unified authorization management: an administrator approves supported servers once, and members automatically gain access afterward, avoiding the governance blind spot of per-person approvals; permission changes must be auditable, so it is advisable to connect a logging service and set up alerts for anomalous calls.
    • Embedded application UI: allow a full interactive interface to be displayed alongside the conversation, or switched to full screen, solving the problem that “plain text struggles to express complex results,” such as tables, charts, and editable forms.
    • Direct file upload and processing: hand documents, spreadsheets, and images straight to the server for parsing, eliminating manual transcription. Implementation should restrict file types and sizes, perform content safety validation, define a data retention period, and prefer storage with encryption and access controls for sensitive data.

    7. A Practical Checklist for Developers

    1. Define the state machine and idempotency semantics before writing tool implementations;
    2. Separate tool metadata from full descriptions, and load on demand by default;
    3. Run long tasks in the background with event notifications, and fall back to polling if notifications fail;
    4. Use structured questions when user input is needed, limit the number of rounds, and define a degraded path;
    5. Keep the server stateless, with state and results externalized to reliable storage;
    6. Build observability: call chain tracing, latency distribution, failure cause classification, and context usage statistics;
    7. For enterprise scenarios, add unified authorization, audit logs, and a data retention policy.

    Conclusion

    700 million monthly downloads and more than 10,000 connectors show that the agent tool ecosystem has crossed the “usability” threshold and entered a competition over “operability.” Background tasks solve throughput, elicitation solves accuracy, on-demand skills and tool search solve context economy, the stateless specification solves elasticity, and unified authorization plus embedded UI solve organizational adoption. Get these five things right, and an agent truly moves from “demoable” to “deliverable.” With generic capabilities from cloud platforms such as Baidu AI Cloud—container platforms hosting stateless services, message queues carrying task events, object storage holding result files, and logging services plus monitoring and alerting providing observability—this forms a reusable engineering foundation.