Skip to content

A2AClientWrapper

Defined in: _worktrees/docs-release/gaunt-sloth/packages/agent/src/modules/a2a/A2AClientWrapper.ts:61

Wrapper around the A2A SDK client for communicating with external agents.

new A2AClientWrapper(config): A2AClientWrapper

Defined in: _worktrees/docs-release/gaunt-sloth/packages/agent/src/modules/a2a/A2AClientWrapper.ts:65

A2AClientConfig

A2AClientWrapper

sendMessage(messageText): Promise<string>

Defined in: _worktrees/docs-release/gaunt-sloth/packages/agent/src/modules/a2a/A2AClientWrapper.ts:98

Sends a message to the A2A agent and returns the response.

string

The message to send to the agent

Promise<string>

The agent’s response as a string


sendMessageWithContext(messageText, context?): Promise<A2AMessageResult>

Defined in: _worktrees/docs-release/gaunt-sloth/packages/agent/src/modules/a2a/A2AClientWrapper.ts:135

BATCH-14 — send one message and return its text ALONG WITH the A2A contextId/taskId needed to thread a multi-turn conversation. Reads the real @a2a-js/sdk result shapes rather than a loose envelope:

  • A Message result carries its text in parts and contextId/taskId directly (both optional, and empty-string when absent in the v1.0 proto model).
  • A Task result — what Google ADK agents commonly return — carries text in status.message.parts (falling back to the last artifact’s parts), contextId (required), and the taskId as Task.id.

context.contextId/taskId are attached to the OUTGOING message only when defined, so a first-turn send stays byte-identical to a contextless one.

string

The message to send to the agent.

A2ASendContext

Optional context/task ids to continue an existing conversation.

Promise<A2AMessageResult>

The agent’s text answer plus the context/task ids from its response.