Skip to main content

Module prelude

Module prelude 

Source
Expand description

What an agent’s source file usually wants: use adam::prelude::*;.

Macros§

tools
Build a ToolSet from tool values, in order: tools![Clock, Search::new()].

Structs§

AgentDef
An agent as its files describe it, before it is tied to tools, state and a model.
Assembly
The agents an AgentDef makes: the root and one LlmAgent for each local subagent definition, ready to register on a runtime.
BoundDef
An agent definition whose tools are bound and whose prompts are rendered, waiting for the state its tools need and for a model. Made by AgentDef::bind.
FnTool
A Tool made from a name, a description, an argument schema and a closure: for tools whose shape is known only at run time (a tool discovered from another service, say) or that are too small to deserve a type.
Json
Returns T to the model as compact JSON text.
Limits
Bounds on one run. A run that reaches max_turns or max_tool_calls gets one closing model call in which it may call no tool, and ends with that answer marked limited (the output’s limited and limit); if the closing call says nothing the run fails with a message naming the limit (RunView::error). The history limit shortens old tool outputs instead (see max_history_tokens).
LlmAgent
A durable LLM tool-calling agent: instructions + a model + a toolset.
State
Shared state as a tool sees it: a cheap-to-clone handle to a T that the agent was given with LlmAgentBuilder::state. Derefs to T.
ToolCtx
What a tool sees of the run it executes in.
ToolOutput
What a successful tool call returns.
ToolSet
An ordered group of tools, built once and handed to an agent.

Enums§

AssemblyError
Why an AgentDef could not be bound to agents.
BuildError
Why LlmAgentBuilder::try_build refused to build an agent.
ToolError
Why a tool call did not produce an output.

Traits§

IntoToolOutput
A value a tool can return as its output.
IntoToolResult
What a tool function returns, as the Tool::call result: any IntoToolOutput, or a Result of one with an error that is Into<ToolError>.
Tool
A capability the model may call.

Attribute Macros§

tool
#[tool]: an async fn becomes a Tool. See the crate docs. Turns an async fn into a tool: keeps the function, and generates a unit struct (the function’s name in UpperCamelCase) that implements adam::Tool.