Context Protocol Extensions: AI Skills and Background Task Execution

    Explore how skill packages, background tasks, interactive elicitation, and direct file uploads extend AI collaboration with external services. This article explains their engineering requirements, from on-demand knowledge loading and asynchronous execution to user approvals, file handling, capability negotiation, and production governance.

    Open protocols for model context are gaining extensions designed for agent collaboration: skill packages, background tasks, interactive elicitation, and direct file uploads. Together, these capabilities point to a shift in how AI interacts with external services. Rather than simply calling a function, an AI system can work with a service more like a specialized agent—learning business procedures, delegating complex workflows, and exchanging information and files during execution.

    This article examines these capabilities from an engineering perspective and outlines practical implementation considerations. All pseudocode is illustrative and does not represent a specific product interface.

    1. From Tool Calls to Capability Collaboration

    Traditional tool calling answers a basic question: what can a service do? Tool names and descriptions expose available operations, but they rarely explain how to use them in a particular business context. Which conditions should be checked first? What sequence should the workflow follow? Which actions require approval? How should failures be handled?

    Skill packages add this procedural layer. Alongside tools, a server can publish skills containing domain knowledge, best practices, multistep workflows, and organization-specific guidance. Clients load relevant skills only when needed, reducing context consumption. Skills are updated alongside the server without requiring users to install them separately.

    The core pattern is capability declaration, on-demand loading, and version synchronization:

    • Tools provide atomic operations.
    • Skills supply workflow and domain knowledge.
    • Tasks move long-running workflows into the background.
    • Elicitation introduces approval or information checkpoints.
    • Files provide a separate data channel.

    Combined, these capabilities create a complete collaboration loop. The AI first loads a skill to understand the scenario, then calls tools to execute individual steps. It delegates time-consuming work to background tasks, pauses for user input before high-risk operations, and uses direct uploads when large files are needed.

    2. Skill Packages: Publishing Business Knowledge with a Service

    A skill package is more than a collection of prompts. It is a maintainable business knowledge asset.

    A practical skill description should include its name, applicable scenarios, prerequisites, execution steps, constraints, expected output, and failure handling. Servers can provide tenant- or organization-specific guidance, but authorization must remain server-side. Sensitive credentials must never be embedded in skill instructions.

    Skills should support versioning, staged rollout, and rollback. If a client does not support skill packages, the service should fall back to ordinary tool descriptions.

    1. skill = {
    2. "name": "store_setup",
    3. "when_to_use": "The user needs to initialize or update online store pages",
    4. "preconditions": ["Store management authorization has been granted"],
    5. "steps": ["Check the domain and template", "Generate the page structure", "Preview and confirm", "Publish"],
    6. "constraints": ["High-risk operations require additional confirmation"],
    7. "output": "Page preview URL and change summary"
    8. }

    More comprehensive skills are not necessarily better. Splitting skills by scenario and loading them on demand reduces context usage and improves maintainability.

    Synchronizing clients with server-side skill updates helps prevent version drift. In multitenant environments, customized guidance should be delivered together with the relevant permission and audit policies.

    3. Background Tasks: Asynchronous Delegation for Long-Running Work

    Task extensions address the problem of waiting. Previously, a client often had to wait for a tool call to finish before proceeding. With background tasks, it can delegate time-consuming work—or an entire agent workflow—to a protocol server, continue other work, and retrieve the result later.

    An implementation needs a clearly defined task lifecycle:

    • Created
    • Queued
    • Running
    • Waiting for input
    • Completed
    • Failed
    • Canceled
    • Timed out

    Task creation should support idempotency keys to prevent duplicate submissions. Results should be passed by reference rather than repeatedly adding large objects to the model context. Status updates can use polling or event notifications, while timeout, retry, and cancellation policies should be configurable.

    Task isolation and audit logs are essential. Asynchronous execution is not stateless execution: the server must persist task state and intermediate results. Clients must also handle cases where a task has completed but its result has already expired.

    1. task = server.enqueue(
    2. action="generate_monthly_report",
    3. input_ref="file_handle_123",
    4. idempotency_key="report-2025-06",
    5. async_mode=True
    6. )
    7. # Returns task_id; the client continues other work
    8. result = server.get_task_result(task_id)

    Observability should cover execution duration, success rate, failure causes, queue depth, and retry counts. Agent workflows may use nested tasks, but nesting depth and concurrency must be limited to prevent resource exhaustion.

    4. Interactive Elicitation: Pausing Execution for Input and Authorization

    Interactive elicitation allows a server to pause a running task, request user input or authorization through a form or link, and resume from the interruption point.

    It addresses an important boundary: an agent should not make high-risk decisions on the user’s behalf. The design should follow these principles:

    • Request only the minimum necessary fields.
    • Clearly explain the risk.
    • Allow users to decline or revoke approval.
    • Prevent replay.
    • Persist the workflow state.

    For example, before creating a paid resource or performing a destructive data operation, a service might ask the user to confirm a resource name or enter a confirmation code.

    Elicitation should not create unnecessary interruptions. A risk-based approach can distinguish between low-risk actions that execute automatically with logging, medium-risk actions that use consolidated confirmation, and high-risk actions that require individual approval.

    Form fields must be validated on the server, not only on the client. Link-based interactions require one-time tokens and expiration times to prevent unauthorized access.

    1. checkpoint = server.request_confirmation(
    2. task_id=task_id,
    3. reason="A high-risk data operation is about to run",
    4. fields=["resource_name", "confirmation_code"],
    5. resume_token="opaque_token"
    6. )
    7. # After user submission, the server validates the input and resumes from the checkpoint

    5. Direct File Uploads: A Data Channel Outside the Context Window

    File upload extensions establish a direct transfer path between the client and the protocol server. Clients can upload PDFs, spreadsheets, images, and other files without passing their contents through the model’s context window.

    This reduces context consumption and avoids truncating large files. Key implementation requirements include:

    • Declare the file’s purpose and retention policy before upload.
    • Use temporary credentials with least-privilege access.
    • Validate file types, enforce size limits, and scan for malicious content on the server.
    • Return a file handle and metadata so subsequent tasks can use references.
    • Tie file lifecycles to tasks and clean up files according to policy when tasks end.
    1. file_ref = client.upload_file(
    2. path="local/report.pdf",
    3. mime_type="application/pdf",
    4. purpose="analysis",
    5. retention="task"
    6. )
    7. # Subsequent tasks pass file_ref, not the file contents

    Direct uploads do not bypass security governance. Encryption in transit, access auditing, and tenant isolation still apply.

    For images and spreadsheets, a server can extract structured information, but the extracted output should also be returned as a reference or summary rather than an unnecessarily large payload.

    6. Implementation Architecture and Governance

    Implementation should begin with capability negotiation. At the start of a session, the client and server exchange supported capabilities and versions, falling back when an extension is unsupported.

    The broader architecture should address several areas:

    • Authorization: Use token-based authorization, least privilege, and tenant isolation.
    • Auditing: Record who invoked which skill, created which task, confirmed which fields, and uploaded which files—and when.
    • Version management: Version skills and protocol extensions independently, use staged rollouts, and preserve rollback options.
    • Observability: Establish logs, metrics, and tracing across the workflow.

    These capabilities belong to open specifications and their extensions. Servers implementing them can work with other compatible clients, so business logic should not be tied to a single client.

    Protocol services can run on general-purpose container platforms or serverless environments and integrate with object storage, logging, monitoring, and alerting services. In cloud environments such as Baidu AI Cloud, the architecture can combine relevant service categories for permissions, auditing, and alerts.

    7. A Practical Checklist for Developers

    • Define the boundary between tools and skills. Tools perform atomic operations; skills provide scenario knowledge and workflow guidance.
    • Design long-running tasks for reliability. Include idempotency keys, timeouts, cancellation, and result references to avoid duplicate execution and context growth.
    • Make high-risk actions explicit checkpoints. Support pausing for elicitation, persist state, and prevent replay.
    • Use direct uploads and file references. Keep large objects out of the context window, and validate file types and permissions after upload.
    • Build a capability matrix and fallback strategy. Account for different clients and protocol versions.
    • Roll out incrementally. Start with a limited deployment, expand gradually, and continuously review audit records and observability metrics.

    The significance of these extensions is not simply that they add more interfaces. They move AI interaction with external systems from isolated calls toward coordinated collaboration.

    Developers should treat skills, tasks, elicitation, and files as a unified protocol surface. Permissions, auditing, version management, and observability are what turn these capabilities into reliable production systems.