Raxol. AgentClientProtocol. Schema. ContentBlock
(Raxol Agent Client Protocol v0.1.0)
Copy Markdown
View Source
Content blocks represent displayable information in ACP: a tagged union
discriminated by a "type" wire key (text | image | audio |
resource_link | resource). Named ContentBlock both upstream and
here (all other structs ported from content.ex -- Role, Annotations,
TextContent, ImageContent, AudioContent, TextResourceContents,
BlobResourceContents, EmbeddedResourceResource, EmbeddedResource,
ResourceLink -- are separate, bare Schema.* modules, not nested under
this one).
Ported from the MIT f1729/agent_client_protocol (c) 2025 f1729; see NOTICE.md.
Summary
Functions
Total: never raises. An unrecognized/missing "type", or a variant body
that fails to decode, returns {:error, _} (a content block has no
documented default variant, unlike e.g. ToolCall.ToolKind).
Convenience: create a text content block from a plain string.
Types
@type t() :: {:text, Raxol.AgentClientProtocol.Schema.TextContent.t()} | {:image, Raxol.AgentClientProtocol.Schema.ImageContent.t()} | {:audio, Raxol.AgentClientProtocol.Schema.AudioContent.t()} | {:resource_link, Raxol.AgentClientProtocol.Schema.ResourceLink.t()} | {:resource, Raxol.AgentClientProtocol.Schema.EmbeddedResource.t()}
Functions
@spec audio(Raxol.AgentClientProtocol.Schema.AudioContent.t()) :: t()
Total: never raises. An unrecognized/missing "type", or a variant body
that fails to decode, returns {:error, _} (a content block has no
documented default variant, unlike e.g. ToolCall.ToolKind).
Convenience: create a text content block from a plain string.
@spec image(Raxol.AgentClientProtocol.Schema.ImageContent.t()) :: t()
@spec resource(Raxol.AgentClientProtocol.Schema.EmbeddedResource.t()) :: t()
@spec resource_link(Raxol.AgentClientProtocol.Schema.ResourceLink.t()) :: t()
@spec text(Raxol.AgentClientProtocol.Schema.TextContent.t()) :: t()