Expand description
Core data models shared by agents, tools, and model adapters.
The types in this module form the data contract between Anda runtimes, model providers, agents, tools, and clients. They cover:
- agent and tool inputs/outputs (
AgentInput,AgentOutput,ToolInput,ToolOutput); - chat messages and multimodal content (
Message,ContentPart); - function-call metadata (
FunctionDefinition,ToolCall); - request metadata and usage accounting (
RequestMeta,Usage); - prompt documents and completion requests (
Document,Documents,CompletionRequest).
Structs§
- Agent
Input - Request sent to an agent for processing.
- Agent
Output - Output produced by an agent execution.
- Byte
Array B64 - Wrapper around
[u8; N]to serialize and deserialize efficiently. If the serialization format is human readable (formats like JSON and YAML), it will be encoded in Base64URL. Otherwise, it will be serialized as a byte array. - Byte
BufB64 - Wrapper around
Vec<u8>to serialize and deserialize efficiently. If the serialization format is human readable (formats like JSON and YAML), it will be encoded in Base64URL. Otherwise, it will be serialized as a byte array. - Completion
Request - Provider-neutral completion request.
- Document
- A document with metadata and content.
- Documents
- Collection of documents that can be injected into a completion prompt.
- Function
- Represents a function definition with its metadata.
- Function
Definition - Defines a callable function with its metadata and schema.
- Message
- Chat message sent to or returned by an LLM provider.
- Partial
Agent Output - Request
Meta - Metadata attached to an agent or tool request.
- Resource
- Represents a resource for AI Agents.
- Resource
Ref - Borrowed view of a
Resourcesuitable for serialization. - Tool
Call - Tool call requested by an LLM or returned by a tool execution pipeline.
- Tool
Input - Request sent to a tool for processing.
- Tool
Output - Output produced by a tool execution.
- Usage
- Usage statistics for an agent, model, or tool execution.
- Xid
- Represents a unique identifier with 12 bytes. Based on the xid. See: https://github.com/rs/xid
Enums§
- Content
Part - A single content item inside a chat message.
- Model
Effort - Provider-agnostic reasoning/thinking effort requested for a completion.
- Prompt
Command
Traits§
- Completion
Features - LLM completion capability exposed by an agent context.
Functions§
- estimate_
tokens - Estimates token count using a small, provider-independent heuristic.
- inline_
data_ from_ data_ url - Parses a data URL string and extracts the inline data and MIME type, if applicable.
- part_
to_ data_ url - Converts a content part with inline data to a data URL string.
- platform_
text_ encoding - Returns the platform-local text encoding used for legacy text files.
- prompt_
with_ resources - select_
resources - Removes and returns resources matching any of the supported tags.
- text_
encoding_ for_ label - Resolves a text encoding label, accepting both
utf8and standard Encoding Standard labels. - text_
encoding_ label - Returns the normalized label used by Anda for a decoded text encoding.
- text_
from - Attempts to decode the given byte vector as text and checks if it looks like text content.
- text_
from_ bytes - Attempts to decode bytes as text and checks if it looks like text content.
- text_
from_ bytes_ with_ encoding - Attempts to decode bytes as text using UTF-8 first and an explicit fallback encoding second.
- text_
resource_ documents - update_
resources - Updates resource metadata before persistence.
- utf8_
text_ from - Attempts to decode the given byte vector as UTF-8 text and checks if it looks like text content.
- utf8_
text_ from_ bytes - Attempts to decode the given byte slice as UTF-8 text and checks if it looks like text content.
- windows_
code_ page_ encoding - Maps a Windows code page number to an Encoding Standard decoder when supported.