Skip to main content
Metadata
FieldValue
Canonical URIhttps://docs.aion.to/extensions/aion/context/get-context/1.0.0
Issueraion
Version1.0.0
ActivationAvailable on all A2A agent servers. No explicit activation required.
Related MethodsGetContexts

Overview

GetContext is a JSON-RPC method that retrieves a specific conversation context by ID, including its full message history and any associated artifacts.

Request

{
  "jsonrpc": "2.0",
  "id": "request-id",
  "method": "GetContext",
  "params": {
    "contextId": "conversation-123",
    "historyLength": 10,
    "historyOffset": 0
  }
}

Parameters

FieldTypeRequiredDescription
contextIdStringrequiredUnique identifier of the conversation context to retrieve.
historyLengthIntegeroptionalMaximum number of recent tasks to return. Defaults to server-defined limit.
historyOffsetIntegeroptionalNumber of recent messages to skip before returning results. Defaults to 0.

Response

Success

{
  "jsonrpc": "2.0",
  "id": "request-id",
  "result": {
    "context_id": "conversation-123",
    "history": [
      {
        "messageId": "msg-1",
        "role": "ROLE_USER",
        "parts": [
          {
            "text": "What's the weather like in Reno today?"
          }
        ]
      },
      {
        "messageId": "msg-2",
        "role": "ROLE_AGENT",
        "parts": [
          {
            "text": "The weather in Reno is a balmy 72F right now."
          }
        ]
      }
    ],
    "artifacts": [],
    "status": {
      "state": "TASK_STATE_COMPLETED"
    }
  }
}
The result field contains a Conversation object.

Conversation

FieldTypeDescription
context_idStringUnique identifier for this conversation context.
historyMessage[]Ordered list of A2A messages in the conversation.
artifactsArtifact[]Generated artifacts produced during the conversation (code, files, documents).
statusConversationTaskStatusCurrent lifecycle state of the conversation.

ConversationTaskStatus

FieldTypeDescription
stateTaskStateCurrent task state (see below).

TaskState

ValueDescription
TASK_STATE_UNSPECIFIEDState is not set.
TASK_STATE_WORKINGTask is actively being processed.
TASK_STATE_INPUT_REQUIREDTask is paused and waiting for user input.
TASK_STATE_AUTH_REQUIREDTask is paused and waiting for authentication.
TASK_STATE_COMPLETEDTask finished successfully.
TASK_STATE_FAILEDTask finished with an error.

Error

{
  "jsonrpc": "2.0",
  "id": "request-id",
  "error": {
    "code": -32000,
    "message": "Server error description",
    "data": {}
  }
}
Error handling follows the JSON-RPC 2.0 specification.

Usage Example

# Retrieve the latest 5 messages from a specific context
request = {
    "jsonrpc": "2.0",
    "id": "get-context-1",
    "method": "GetContext",
    "params": {
        "contextId": "conversation-123",
        "historyLength": 5
    }
}