a2a.server.agent_execution.context module¶
- class a2a.server.agent_execution.context.RequestContext(call_context: ServerCallContext, request: SendMessageRequest | None = None, task_id: str | None = None, context_id: str | None = None, task: Task | None = None, related_tasks: list[Task] | None = None, task_id_generator: IDGenerator | None = None, context_id_generator: IDGenerator | None = None)¶
Bases:
objectRequest Context.
Holds information about the current request being processed by the server, including the incoming message, task and context identifiers, and related tasks.
Attaches a related task to the context.
This is useful for scenarios like tool execution where a new task might be spawned.
- Parameters:
task – The Task object to attach.
- property call_context: ServerCallContext¶
The server call context associated with this request.
- property configuration: SendMessageConfiguration | None¶
The SendMessageConfiguration from the request, if available.
- property context_id: str | None¶
The ID of the conversation context associated with this task.
- get_user_input(delimiter: str = '\n') str¶
Extracts text content from the user’s message parts.
- Parameters:
delimiter – The string to use when joining multiple text parts.
- Returns:
A single string containing all text content from the user message, joined by the specified delimiter. Returns an empty string if no user message is present or if it contains no text parts.
- property metadata: dict[str, Any]¶
Metadata associated with the request, if available.
A list of tasks related to the current request.
- property requested_extensions: set[str]¶
Extensions that the client requested for this interaction.
- property task_id: str | None¶
The ID of the task associated with this context.
- property tenant: str¶
The tenant associated with this request.