Skip to main content
All Python modules · Import and compatibility guidance

Client operations

A2A event fields

The A2A contextId maps to the Harnest session ID. A text-input root accepts A2A text parts; a typed-input root requires exactly one structured data part. Harnest projects customer-visible text and structured results back to A2A parts while keeping tool arguments and results inside the executing agent boundary regardless of tool_activity. With OutputPolicy(thinking=True), a streaming Task emits provider-exposed reasoning as a working-status message whose metadata.harnest.type is thinking; reasoning is otherwise suppressed. Agent and graph-node lifecycle updates use the same working status with metadata.harnest.type: agent_activity; model metadata uses metadata.harnest.type: agent_metadata. Set agent_metadata=AgentMetadataMode.SUPPRESS to omit those updates and aggregate token counts from the final Message or Task artifact. Answer artifacts can carry metadata.harnest.agent attribution. With OutputPolicy(decision_results=True), streaming tasks also publish working-status metadata with metadata.harnest.type: decision_result and the typed decision in metadata.harnest.value. Decision results are hidden by default.

Exports

A2AClient

Discover and invoke one remote agent without background polling or listing.

A2AClient.card

Return the validated cached card without triggering network I/O.

A2AClient.connect

Resolve and validate the Agent Card exactly once for this client.

A2AClient.send

Send one message and poll only when the caller requested a final result.

A2AClient.stream

Yield remote updates without issuing any implicit follow-up operations.

A2AClient.get_task

Fetch one task only after an explicit caller request.

A2AClient.list_tasks

List a bounded page only when directly requested by application code.

A2AClient.cancel_task

Cancel one task only in response to explicit local cancellation.

A2AClient.subscribe

Subscribe to an existing task without fetching or listing others.

A2AClient.close

Close the selected transport or the unused discovery client once.

A2AClient.aenter

A2AClient.aexit

A2AClientError

An outbound A2A interaction failed Harnest policy or protocol handling.

A2AResult

Minimum portable projection of a direct Message or tracked A2A Task.
Fields (— means no declared default):

A2AResult.terminal

Return whether the remote interaction no longer needs observation.

A2AResult.as_dict

Serialize only portable output and opaque task references.

A2AUpdate

One normalized outbound stream update without protobuf coupling.
Fields (— means no declared default):

RemoteAgent

A first-class remote A2A participant usable as a portable graph node.
Fields (— means no declared default):

RemoteAgent.call

Delegate one graph value and retain only opaque conversation references.

RemoteAgent.as_tool

Expose delegation as an explicit text tool when agent semantics are unsuitable.

RemoteAgentError

A remote agent reached a terminal failure state.