Types
Shared types used throughout the harness. All are exported from the top-level
data_harness package.
ToolSpec
data_harness.ToolSpec
dataclass
ToolSpec(
name: str,
description: str,
input_schema: dict,
handler: Callable[..., Any] | None = None,
visible: bool = True,
annotations: ToolAnnotations | None = None,
)
Everything the harness needs to register and dispatch one tool.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Unique tool name exposed to the model. |
description |
str
|
Natural-language description shown to the model. |
input_schema |
dict
|
JSON Schema object describing the tool's parameters. |
handler |
Callable[..., Any] | None
|
Callable invoked with |
visible |
bool
|
Whether the tool appears in the model's tool list. Hidden tools
can still be called if the model somehow names them; set
|
annotations |
ToolAnnotations | None
|
Optional side-effect hints passed to |
to_provider_dict
Return the provider-facing tool dict (name, description, input_schema).
Message
data_harness.Message
dataclass
A single turn in the conversation history.
Attributes:
| Name | Type | Description |
|---|---|---|
role |
Literal['user', 'assistant']
|
Either |
content |
list[ContentBlock]
|
Ordered list of content blocks for this turn. |
TextBlock
data_harness.TextBlock
dataclass
A plain-text content block inside a Message.
Attributes:
| Name | Type | Description |
|---|---|---|
text |
str
|
The raw text content. |
ToolUseBlock
data_harness.ToolUseBlock
dataclass
A tool-invocation block emitted by the model.
Attributes:
| Name | Type | Description |
|---|---|---|
tool_use_id |
str
|
Unique identifier for this invocation, echoed back in the
matching |
tool_name |
str
|
Name of the tool to call. |
tool_input |
dict
|
Parsed JSON arguments for the tool. |
ToolResultBlock
data_harness.ToolResultBlock
dataclass
The harness-side result of a tool invocation.
Attributes:
| Name | Type | Description |
|---|---|---|
tool_use_id |
str
|
Must match the |
content |
str
|
Serialised tool output, or an error message when |
is_error |
bool
|
Whether the tool call raised an exception. |
ToolAnnotations
data_harness.ToolAnnotations
dataclass
ToolAnnotations(
title: str | None = None,
read_only: bool | None = None,
cache_mutating: bool | None = None,
destructive: bool | None = None,
open_world: bool | None = None,
)
Model-visible hints about a tool's side-effect profile.
All fields are optional. Omitted fields are treated as unknown by the harness; set them explicitly when the information is relevant to how the model should reason about the tool.
Attributes:
| Name | Type | Description |
|---|---|---|
title |
str | None
|
Human-readable display name for the tool. |
read_only |
bool | None
|
True if the tool never mutates external state. |
cache_mutating |
bool | None
|
True if the tool writes to the session cache. |
destructive |
bool | None
|
True if the tool performs irreversible side effects. |
open_world |
bool | None
|
True if the tool can reach external systems at runtime. |
ContentBlock
ContentBlock is a type alias for the union of the three block types that can
appear in a Message: