Skip to main content
Reference tooling Archived 10 min read Updated

protocol-v1-prompt-turn

Documentation Index

Fetch the complete documentation index at: https://agentclientprotocol.com/llms.txt Use this file to discover all available pages before exploring further.

Prompt Turn

Understanding the core conversation flow

A prompt turn represents a complete interaction cycle between the Client and Agent, starting with a user message and continuing until the Agent completes its response. This may involve multiple exchanges with the language model and tool invocations.

Before sending prompts, Clients MUST first complete the initialization phase and session setup.

Session Updates

Agents send session/update notifications to report streamed content, tool activity, and changes to session state. The sessionUpdate field inside params.update identifies the variant:

sessionUpdate valueDescription
user_message_chunkA streamed chunk of a user message.
agent_message_chunkA streamed chunk of the Agent’s response.
agent_thought_chunkA streamed chunk of the Agent’s reasoning.
tool_callA new tool call.
tool_call_updateA change to a tool call’s status or results.
planThe Agent’s execution plan.
available_commands_updateThe set of available slash commands is ready or has changed.
current_mode_updateThe current session mode has changed.
config_option_updateThe session’s configuration options have changed.
session_info_updateSession metadata, such as the title or last update time, has changed.
usage_updateThe session’s context window usage and cumulative cost.
noticeA live user-facing notice that is not part of session history. Requires the Client’s session.notices capability.
compaction_updateCreates or updates a context compaction. Requires the Client’s session.compaction capability.
compaction_summary_chunkAppends content to a compaction’s retained summary. Requires the Client’s session.compaction capability.

This is the complete set of variants defined in the current SessionUpdate schema, which describes each payload in detail. The walkthrough below illustrates common uses of these updates.

Session updates are not limited to active prompt turns. For example, Agents may advertise commands after creating a session, and replay user and Agent messages when loading a session.

The Prompt Turn Lifecycle

A prompt turn follows a structured flow that enables rich interactions between the user, Agent, and any connected tools.

sequenceDiagram
    participant Client
    participant Agent

    Note over Agent,Client: Session ready

    Note left of Client: User sends message
    Client->>Agent: session/prompt (user message)
    Note right of Agent: Process with LLM

    loop Until completion
        Note right of Agent: LLM responds with<br/>content/tool calls
        Agent->>Client: session/update (plan)
        Agent->>Client: session/update (agent_message_chunk)

        opt Tool calls requested
            Agent->>Client: session/update (tool_call)
            opt Permission required
                Agent->>Client: session/request_permission
                Note left of Client: User grants/denies
                Client-->>Agent: Permission response
            end
            Agent->>Client: session/update (tool_call status: in_progress)
            Note right of Agent: Execute tool
            Agent->>Client: session/update (tool_call status: completed)
            Note right of Agent: Send tool results<br/>back to LLM
        end

      opt User cancelled during execution
          Note left of Client: User cancels prompt
          Client->>Agent: session/cancel
          Note right of Agent: Abort operations
          Agent-->>Client: session/prompt response (cancelled)
      end
    end

    Agent-->>Client: session/prompt response (stopReason)

1. User Message

The turn begins when the Client sends a session/prompt:

{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "session/prompt",
  "params": {
    "sessionId": "sess_abc123def456",
    "prompt": [
      {
        "type": "text",
        "text": "Can you analyze this code for potential issues?"
      },
      {
        "type": "resource",
        "resource": {
          "uri": "file:///home/user/project/main.py",
          "mimeType": "text/x-python",
          "text": "def process_data(items):\n    for item in items:\n        print(item)"
        }
      }
    ]
  }
}

sessionId SessionId required

The ID of the session to send this message to.

prompt ContentBlock[] required

The contents of the user message, e.g. text, images, files, etc.

Clients MUST restrict types of content according to the Prompt Capabilities established during initialization.

Learn more about Content

Open

2. Agent Processing

Upon receiving the prompt request, the Agent processes the user’s message and sends it to the language model, which MAY respond with text content, tool calls, or both.

3. Agent Reports Output

The Agent reports the model’s output to the Client via session/update notifications. This may include the Agent’s plan for accomplishing the task:

{
  "jsonrpc": "2.0",
  "method": "session/update",
  "params": {
    "sessionId": "sess_abc123def456",
    "update": {
      "sessionUpdate": "plan",
      "entries": [
        {
          "content": "Check for syntax errors",
          "priority": "high",
          "status": "pending"
        },
        {
          "content": "Identify potential type issues",
          "priority": "medium",
          "status": "pending"
        },
        {
          "content": "Review error handling patterns",
          "priority": "medium",
          "status": "pending"
        },
        {
          "content": "Suggest improvements",
          "priority": "low",
          "status": "pending"
        }
      ]
    }
  }
}

Learn more about Agent Plans

Open

The Agent then reports text responses from the model:

{
  "jsonrpc": "2.0",
  "method": "session/update",
  "params": {
    "sessionId": "sess_abc123def456",
    "update": {
      "sessionUpdate": "agent_message_chunk",
      "messageId": "msg_agent_c42b9",
      "content": {
        "type": "text",
        "text": "I'll analyze your code for potential issues. Let me examine it..."
      }
    }
  }
}

Message IDs

The Agent MAY include an opaque, unique messageId on message chunks. Chunks with the same messageId belong to the same message; a changed messageId indicates a new message.

If the model requested tool calls, these are also reported immediately:

{
  "jsonrpc": "2.0",
  "method": "session/update",
  "params": {
    "sessionId": "sess_abc123def456",
    "update": {
      "sessionUpdate": "tool_call",
      "toolCallId": "call_001",
      "title": "Analyzing Python code",
      "kind": "other",
      "status": "pending"
    }
  }
}

Session Notices

The Agent MUST NOT send notice updates unless the Client advertised support by supplying clientCapabilities.session.notices: {} in its initialize request. Omitting session or notices, or setting either field to null, means the Client does not advertise support.

When the capability is absent, the Agent may use an ordinary agent message instead if the information should still be surfaced to the user. That fallback is conversation content and follows normal message-history semantics.

When the Client advertises support, the Agent MAY send a live user-facing notice at any point while a session exists, including outside prompt processing:

{
  "jsonrpc": "2.0",
  "method": "session/update",
  "params": {
    "sessionId": "sess_abc123def456",
    "update": {
      "sessionUpdate": "notice",
      "severity": "warning",
      "title": "MCP server unavailable",
      "description": "Continuing without it."
    }
  }
}

severity is required and non-null and initially supports info, warning, and error. It is an open string enum: values beginning with _ are reserved for implementation-specific extensions, while other unknown values are reserved for future ACP severities. Clients preserve unknown values and use a generic notice presentation without inferring additional behavior from them.

title is required, non-null, non-empty plain text suitable for a compact presentation. description is optional, nullable plain text with supporting detail; omission and null both mean no description. _meta is an optional, nullable object scoped to this event; omission and null both mean no event metadata. Unlike compaction patch fields, these fields do not update or clear an earlier notice.

Advertising support does not acknowledge delivery or guarantee display of an individual notice. Agents must still behave as though a notice may not have been received, displayed, or seen. A notice must not carry information required for protocol correctness, authorization, user action, task completion, or fatal-error reporting.

Clients own presentation and dismissal. They may use a toast, banner, inline status region, notification center, or another accessible surface, and may coalesce repeated notices. Severity is only a presentation hint; even error does not fail a request, stop foreground work, change session state, or imply a prompt stop reason. Dismissal is local and produces no acknowledgement or removal event.

Notices have no ID or Agent-managed lifecycle. Each occurrence is an independent live event, not conversation history, and SHOULD NOT be included in session replay. If a condition remains relevant after reconnecting, the Agent may emit a new notice.

Session Compaction

The Agent MUST NOT send compaction_update or compaction_summary_chunk unless the Client advertised support by supplying clientCapabilities.session.compaction: {} in its initialize request. Omitting session or compaction, or setting either field to null, means the Client does not support these updates. This requirement applies to both live updates and history replay.

When the capability is absent, the Agent may describe compaction through an ordinary agent message instead. That fallback is conversation content, not an ID-addressed compaction entity, and follows normal message-history semantics.

When the Client advertises support, the Agent MAY report context compaction as one persistent, ID-addressed timeline entity. A single compaction_update with status: "completed" is sufficient; reporting progress is optional. Summary content is also optional. It may be sent all at once in the summary field or streamed using compaction_summary_chunk for the same compactionId.

For example, an Agent can report that compaction has started:

{
  "jsonrpc": "2.0",
  "method": "session/update",
  "params": {
    "sessionId": "sess_abc123def456",
    "update": {
      "sessionUpdate": "compaction_update",
      "compactionId": "cmp_001",
      "status": "in_progress"
    }
  }
}

compactionId and status are required and non-null on every compaction_update. The ID is an opaque, Agent-owned string, unique within the session, and MUST NOT be reused for another compaction.

Clients initialize a first-seen compaction ID with status in_progress and unset optional fields, then apply the notification.

The first notification fixes the entity’s timeline position in receive order: it follows previously received timeline content and precedes content first received later. Later updates and chunks for an ID-addressed entity patch it in place; they do not move or split it around the compaction.

statusMeaning
in_progressCompaction has started and has not finished.
completedCompaction finished successfully.
failedCompaction finished unsuccessfully.
cancelledCompaction was cancelled before it finished.

The Agent MUST report a terminal status when a reported compaction ends.

status is an open string enum. Values beginning with _ are reserved for implementation-specific extensions; other unknown values are reserved for future ACP statuses. Clients preserve unknown strings and present a generic state without inferring lifecycle or control behavior.

If the retained summary is available incrementally, the Agent may append one content block at a time:

{
  "jsonrpc": "2.0",
  "method": "session/update",
  "params": {
    "sessionId": "sess_abc123def456",
    "update": {
      "sessionUpdate": "compaction_summary_chunk",
      "compactionId": "cmp_001",
      "content": {
        "type": "text",
        "text": "## Retained context\n\n"
      }
    }
  }
}

compactionId and content are required and non-null on each chunk. Chunk _meta is optional and nullable, is scoped to that chunk, and has no patch semantics: omission and null both mean no chunk metadata.

An update may omit summary to retain the streamed content. A non-streaming Agent can instead supply the complete summary, and a streaming Agent can use the same field as an authoritative replacement of content received so far:

{
  "jsonrpc": "2.0",
  "method": "session/update",
  "params": {
    "sessionId": "sess_abc123def456",
    "update": {
      "sessionUpdate": "compaction_update",
      "compactionId": "cmp_001",
      "status": "completed",
      "summary": [
        {
          "type": "text",
          "text": "## Retained context\n\nThe user is updating the ACP schema."
        }
      ]
    }
  }
}

The following compaction_update fields are optional, nullable patches:

FieldTypeMeaning
summaryContentBlock[]The unencrypted, user-displayable summary content produced or retained by compaction.
errorstringA human-readable error description.
_metaobjectExtensible metadata for the compaction entity.

For each patch field, omission leaves the stored value unchanged, null clears it, and a concrete value replaces it. On a first-seen ID, omission and null both start with no value. summary: [] also clears the summary.

Clients apply updates and chunks in receive order for each ID. Chunks append to the current summary; a concrete summary replaces all previously accumulated content, and any subsequent chunks append to that replacement. summary: null or summary: [] clears accumulated content, including partial output before failure or cancellation.

The summary is not the Agent’s complete replacement history or generic status text such as “Compaction completed”. It should faithfully represent the retained, user-displayable summary without internal prompt framing or hidden instructions. Text blocks may contain Markdown. Agents should omit it when no unencrypted summary is available or when disclosure would reveal context that was not otherwise user-visible.

During history replay, compaction updates and summary chunks follow the same semantics as live delivery.

Replay does not implicitly reset omitted patch fields. Agents use replacement or clearing summary patches as needed to avoid duplicating content the Client already holds.

Compaction does not instruct the Client to discard earlier conversation history; collapsing it is a local presentation choice. It also does not replace usage_update, which reports current context-window utilization and cost rather than a compaction boundary.

Session Usage Updates

The Agent MAY also report current session context and cumulative cost state with a usage_update:

{
  "jsonrpc": "2.0",
  "method": "session/update",
  "params": {
    "sessionId": "sess_abc123def456",
    "update": {
      "sessionUpdate": "usage_update",
      "used": 53000,
      "size": 200000,
      "cost": {
        "amount": 0.045,
        "currency": "USD"
      }
    }
  }
}

used and size are required and non-null token counts for the current session context. cost is optional and, if present, amount and currency are required. currency is an ISO 4217 currency code like "USD".

4. Check for Completion

If there are no pending tool calls, the turn ends and the Agent MUST respond to the original session/prompt request with a StopReason:

{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "stopReason": "end_turn"
  }
}

Agents MAY stop the turn at any point by returning the corresponding StopReason.

5. Tool Invocation and Status Reporting

Before proceeding with execution, the Agent MAY request permission from the Client via the session/request_permission method.

Once permission is granted (if required), the Agent SHOULD invoke the tool and report a status update marking the tool as in_progress:

{
  "jsonrpc": "2.0",
  "method": "session/update",
  "params": {
    "sessionId": "sess_abc123def456",
    "update": {
      "sessionUpdate": "tool_call_update",
      "toolCallId": "call_001",
      "status": "in_progress"
    }
  }
}

As the tool runs, the Agent MAY send additional updates, providing real-time feedback about tool execution progress.

While tools execute on the Agent, they MAY leverage Client capabilities such as the file system (fs) methods to access resources within the Client’s environment.

When the tool completes, the Agent sends another update with the final status and any content:

{
  "jsonrpc": "2.0",
  "method": "session/update",
  "params": {
    "sessionId": "sess_abc123def456",
    "update": {
      "sessionUpdate": "tool_call_update",
      "toolCallId": "call_001",
      "status": "completed",
      "content": [
        {
          "type": "content",
          "content": {
            "type": "text",
            "text": "Analysis complete:\n- No syntax errors found\n- Consider adding type hints for better clarity\n- The function could benefit from error handling for empty lists"
          }
        }
      ]
    }
  }
}

Learn more about Tool Calls

Open

6. Continue Conversation

The Agent sends the tool results back to the language model as another request.

The cycle returns to step 2, continuing until the language model completes its response without requesting additional tool calls or the turn gets stopped by the Agent or cancelled by the Client.

Stop Reasons

When an Agent stops a turn, it must specify the corresponding StopReason:

end_turn

The language model finishes responding without requesting more tools

max_tokens

The maximum token limit is reached

max_turn_requests

The maximum number of model requests in a single turn is exceeded

refusal

The Agent refuses to continue

cancelled

The Client cancels the turn

Cancellation

Clients MAY cancel an ongoing prompt turn at any time by sending a session/cancel notification:

{
  "jsonrpc": "2.0",
  "method": "session/cancel",
  "params": {
    "sessionId": "sess_abc123def456"
  }
}

The Client SHOULD preemptively mark all non-finished tool calls pertaining to the current turn as cancelled as soon as it sends the session/cancel notification.

The Client MUST respond to all pending session/request_permission requests with the cancelled outcome.

When the Agent receives this notification, it SHOULD stop all language model requests and all tool call invocations as soon as possible.

After all ongoing operations have been successfully aborted and pending updates have been sent, the Agent MUST respond to the original session/prompt request with the cancelled stop reason.

[!WARNING]

API client libraries and tools often throw an exception when their operation is aborted, which may propagate as an error response to session/prompt.

Clients often display unrecognized errors from the Agent to the user, which would be undesirable for cancellations as they aren’t considered errors.

Agents MUST catch these errors and return the semantically meaningful cancelled stop reason, so that Clients can reliably confirm the cancellation.

The Agent MAY send session/update notifications with content or tool call updates after receiving the session/cancel notification, but it MUST ensure that it does so before responding to the session/prompt request.

The Client SHOULD still accept tool call updates received after sending session/cancel.


Once a prompt turn completes, the Client may send another session/prompt to continue the conversation, building on the context established in previous turns.

This documentation is built and hosted on Mintlify, a developer documentation platform.