Expand description
§adam
The facade of adam-rs: one dependency for writing an agent. It re-exports
adam-llm-agent (with its schema feature), the #[tool] macro of
adam-macros, and the model, runtime, core and error crates as modules
(adam::model, adam::runtime, adam::core, adam::error), adam-agent-fs
as adam::agent_fs, adam-assembly as adam::assembly, and it adds a
prelude and the include_agent! macro.
[dependencies]
adam = "0.1"| Feature | Default | What |
|---|---|---|
macros | yes | #[tool] (adam::tool, and in the prelude) |
remote | yes | remote subagents (a2a: in a subagent file): the A2A client, an HTTP client and TLS (turns on adam-assembly/remote; see Without remote subagents). An application that embeds adam (ADR 0047) turns it off with default-features = false, and bind then refuses an a2a: subagent with Error::RemoteNotEnabled. This crate depends on adam-assembly without its defaults, so a crate that turns adam’s off gets no remote |
a2a | no | Assembly::card: the root agent’s card: as an adam_a2a::AgentCardConfig (turns on adam-assembly/a2a, and with it adam-assembly/remote) |
mcp | no | mcp.json tools: adam::mcp (the MCP client: McpPolicy, Env, McpServers) and AgentDef::connect_mcp, which connects each agent’s MCP servers at startup and gives it their tools as <server>__<tool> (turns on adam-assembly/mcp; see MCP tools). Off by default: a build cannot start a process or reach a server because an mcp.json said so unless it opts in |
dev | no | dev reload: adam::LiveAssembly watches the agent directory and swaps the agents when a file changes (turns on adam-assembly/dev, which brings notify). Off by default, so a release build cannot watch and reload prompts unless it opts in. Reading a folder once, at startup, needs no feature: adam::AgentFolder |
Breaking: remote subagents are the feature remote. A crate that depends on adam with default-features = false
(for example features = ["macros"]) had them and now has not: it still compiles, and bind refuses an a2a: subagent
with Error::RemoteNotEnabled. Add "remote" to its features to keep them.
adam::EXTRA_MCP_FILE_ENV (ADAM_EXTRA_MCP_FILE) and adam::extra_mcp_file_from_env() name a file of extra MCP servers, in
the shape of mcp.json, that a binary adds to the agent’s own with AgentDef::with_extra_mcp_file (a name both have is an
error; AgentDef::mcp_env_references lists the ${VAR} names of every local agent’s servers). No feature for those;
connecting the servers is the feature mcp. See
extra MCP servers and
ADR 0018. adam::agent_fs::McpServer
has the field optional (optional: true in the file: a server that may be missing at startup).
The authoring layer around it (agent directories, skills, subagents) is designed in
docs/reference/agent-files.md. What exists: #[tool], the agent directory
embedded at build time (adam::include_agent!(), below), and AgentDef, which binds it to
LlmAgents (adam-assembly, also adam::assembly), adam::AgentFolder, which
reads one agent’s folder when the process starts (ADAM_AGENT_DIR, no feature; see
run-time folders), and, with the feature
dev, adam::LiveAssembly, which reloads the directory while the process runs (the rules for runs in flight
are in the dev reload section).
§#[tool]
An async fn becomes a tool. The function stays as it is (call it directly in a unit test), and a
unit struct named after it (get_weather becomes GetWeather) implements Tool.
use std::sync::Arc;
use adam::model::MockModel;
use adam::prelude::*;
/// Shared state: any `Send + Sync + 'static` type the agent is given.
struct Units(&'static str);
/// Get the current weather for a city. Say which city; the answer is
/// in the agent's configured units.
#[tool]
pub async fn get_weather(
units: State<Units>,
/// The city, for example "Berlin"
city: String,
/// Days of forecast to include (default 0)
#[serde(default)]
days: u32,
) -> Result<String, ToolError> {
if city.trim().is_empty() {
return Err(ToolError::Permanent("city is empty".into()));
}
Ok(format!("{city}: 18 degrees {} (+{days} days)", units.0))
}
// The spec is what the model sees: name from the function, description from its doc comment,
// property descriptions from the parameter docs, `required` from the types.
let spec = GetWeather.spec();
assert_eq!(spec.name, "get_weather");
assert_eq!(
spec.description,
"Get the current weather for a city. Say which city; the answer is in the agent's configured units."
);
assert_eq!(spec.parameters["required"], serde_json::json!(["city"]));
assert_eq!(spec.parameters["properties"]["city"]["description"], "The city, for example \"Berlin\"");
// `State<Units>` is checked when the agent is built, not in the middle of a run.
let _agent = LlmAgent::builder("assistant", Arc::new(MockModel::new()), "my-model")
.state(Arc::new(Units("C")))
.tools(tools![GetWeather])
.try_build()
.expect("every tool has its state");§What the macro accepts
| In the function | Becomes |
|---|---|
| the doc comment (required) | the tool’s description. Wrapped lines are joined with a space; a blank line keeps a paragraph break; list items, headings, quotes and fenced code keep their own lines |
| a doc comment on a parameter | that argument’s description in the schema |
name: T | a field of the generated arguments struct, which derives Deserialize and JsonSchema. T must be owned; Option<T> and #[serde(default)] make it optional |
#[serde(..)], #[schemars(..)] on a parameter | copied to that field |
&ToolCtx (at most one, any position) | the call’s context: run id, call id, cancellation, progress |
State<T> (any number) | the shared T from the agent, read with ctx.require_state::<T>()? and reported by Tool::required_state, so try_build fails at startup when it is missing |
#[args] a: MyArgs | an existing Deserialize + JsonSchema struct as the whole argument object; the only model argument |
| the return type | Result<T, E> or a bare T, with T: IntoToolOutput (ToolOutput, String, &'static str, Value, Json<S>) and E: Into<ToolError> |
Bad input from the model is not an error of the run: a JSON mismatch becomes a ToolOutput::error
(the text is “invalid arguments for get_weather: missing field city”, with backticks around the names)
that the model reads and corrects.
The call still runs inside LlmAgent’s journaled tool:CALL_ID step, so the retry rules of the Tool
docs apply unchanged.
Options, #[tool(..)]:
| Option | Meaning |
|---|---|
name = "..." | the tool’s name; default the function’s. Must match ^[a-z][a-z0-9_]{0,63}$ |
type = Name | the generated struct; default the function’s name in UpperCamelCase. It has the function’s visibility |
strict | unknown argument fields are refused (deny_unknown_fields, and additionalProperties: false in the schema) |
classify | the error type is adam::error::Classify (adam_error::Classify): retryable classes become ToolError::Transient (or Retryable with the class, for a rate limit or a conflict), the others Permanent (ToolError::from_classified) |
retry(attempts = 3, backoff = "1s", max_backoff = "30s", multiplier = 2.0, on = ["rate-limited"]) | the tool’s retry policy (Tool::retry_policy, ADR 0061): its failures are counted under tool:<name> and retried attempts times in all (required, at least 1) with that backoff (durations 500ms, 1s, 30m, 1h; max_backoff not under backoff; what is left out is RetryPolicy’s default, not the runtime’s configured policy: 1 s, 60 s, 2.0; a max_backoff under 1 s needs a backoff) for the classes in on (transient, rate-limited, conflict; default all three). A policy set for the tool by name (an agent folder’s retry:) wins over it |
paged | the tool’s results are pages of the paging convention (offset and limit in, one final line out): the generated Tool::paged says true, and the loop’s 64 KiB cap on a result then tells the model to call again with a later offset. Never inferred from an argument called offset |
asks_user | the tool can end a call with ToolError::NeedsInput: the generated Tool::asks_user says true, so the loop runs such a call alone. A subagent may have it: whether the person can be asked is decided per run (a round of a kept-open session a client shows asks; any other child run is told nobody can answer it) |
step = "subagent", label = "Hand to the helper", icon = "agent" | how a call is drawn as a step (Tool::step_style): step is the kind (subagent, tool, command, message; default tool), label replaces the tool’s name as the label, icon is one of agent, read, edit, delete, move, search, execute, think, fetch, web, git, test, file, tool, opencode (the orchestration layer’s steps/v1; any other word is a compile error that lists them). Any one of them is enough |
parallel = "independent" | "read" | "write" | "exclusive", path = "<argument>", access = path::to::fn | what a call shares with the other calls of its turn (Tool::access, ADR 0049). independent shares nothing; read and write use the scope files, or files/<value of the argument named by path> (normalised lexically: ./ and . dropped; an absolute path or one with .. widens to files); exclusive is Alone; access names a fn(&serde_json::Value) -> ToolAccess for anything else (parallel and access are exclusive, path goes with read or write and must name an argument). Two calls conflict when one is Alone, or their scopes overlap (equal, or a prefix at a /) and one writes. Without any of them the tool is Alone: it runs by itself |
crate = path | where Tool and __private live; default ::adam. ::adam_llm_agent works without the facade, see below |
The schema is computed once per tool (a OnceLock) and is draft 2020-12 with subschemas inlined, no
$schema and no title (see spec_for in adam-llm-agent).
§Without the facade
A crate that depends on adam-llm-agent alone (feature schema) points the macro at it:
use adam_llm_agent::{ToolError, ToolOutput};
use adam_macros::tool;
/// Echo the text back.
#[tool(crate = ::adam_llm_agent)]
async fn echo(text: String) -> Result<ToolOutput, ToolError> {
Ok(ToolOutput::text(text))
}adam_llm_agent::__private carries the paths the generated code needs (serde, schemars,
async_trait, spec_for, parse_args, …), so the crate using the macro needs none of them itself.
Your own #[derive(Deserialize, JsonSchema)] types (for #[args], or as an argument type) still need
serde and schemars in your Cargo.toml; adam-llm-agent‘s schema feature enables schemars’
derive.
§Agent directories: include_agent!
An agent written as Markdown files (agent/instructions.md, skills, subagents, mcp.json) is
compiled into the binary by a build script and included with one line.
[dependencies]
adam = "0.1"
[build-dependencies]
adam-agent-fs = { version = "0.1", features = ["build"] }// build.rs: parses and validates agent/ before rustc runs; a mistake is a build error with
// file:line, and a new or changed file reruns the script.
fn main() -> Result<(), adam_agent_fs::BuildError> {
adam_agent_fs::build("agent").emit()?;
Ok(())
}// src/main.rs
adam::include_agent!(); // AGENTS, AGENT (for agent/) and PACKAGE, all `'static`
fn main() {
println!("{} {}", AGENT.name, AGENT.digest); // the digest identifies these exact files
println!("{}", AGENT.instructions.body); // the prompt, no parsing at startup
for skill in AGENT.skills { // the catalog
println!("{}: {}", skill.name, skill.description);
}
}AGENT is a &'static adam::agent_fs::EmbeddedAgent.
PACKAGE is an EmbeddedPackage, a ManifestSource like adam::agent_fs::Dir, so the same
Package can come from the binary or from a directory at run time and the two compared. The macro
is include!(concat!(env!("OUT_DIR"), "/adam_agent.rs")) and nothing else; it needs the build
script and a crate that depends on adam (the generated code names ::adam::agent_fs; use
.crate_path("::adam_agent_fs") when it depends on adam-agent-fs directly).
adam-agent-fixture is a complete example with tests.
§Binding the agent: AgentDef
AgentDef (in the prelude, from adam-assembly) turns the embedded
agent, or one read from a directory, into LlmAgents. Every mistake is found at startup, with the agent
and the file in the message.
use std::sync::Arc;
use adam::prelude::*;
adam::include_agent!();
let assembly = AgentDef::from_manifest(AGENT)? // or an AgentManifest from a Dir
.var("repo", "acme/widgets") // a value for {{repo}} in the prompt
.bind(tools![PrepareWorkspace, RunChecks, AskUser])? // `tools:` in the files must name these
.state(Arc::new(env)) // what `State<T>` parameters read
.model(model, "coder-large")?; // one client; the default gateway alias
let runtime = assembly.register(Runtime::builder(store)).build(); // the root and every subagentA typo in the files fails bind: a tools: [run_check] gets
agent `coder` (agent/instructions.md): `tools` names `run_check`, which is not a registered tool; did you mean `run_checks`?,
and so do a {{placeholder}} that vars does not declare, a var that is never used, and a var with no
value. The stages, the rules for tools, vars, models, state and skills, and the seams left for
subagents are in the adam-assembly README. Assembly::info() describes
each agent made (name, alias, rendered prompt, tools, skills, limits); with the a2a feature,
Assembly::card(url, version) is the root’s AgentCardConfig (AgentDef::card gives it before
anything is bound).
An agent’s skills/ need no code: the prompt gets a catalog (name and description of each skill) and the
agent gets a load_skill tool (a page of the body of SKILL.md, by a plain string name) and a read_skill_file tool (a page of a bundled text file),
the Agent Skills progressive disclosure. preload_skills: puts a
body in the prompt instead; AgentDef::run_skills lets the root load skills a run finds (<source>/<skill>). It works the same for the embedded agent and for a directory read with
AgentDef::from_source.
§Compile errors
The macro checks what it can and says so where you wrote it:
| Mistake | Message |
|---|---|
| no doc comment | #[tool] needs a doc comment: it is the description the model reads |
not async | #[tool] functions must be async |
generic, where, or impl Trait | #[tool] functions cannot be generic; model arguments are deserialized into concrete types |
self receiver | #[tool] works on free functions; put shared state in State<T> |
&str argument | model arguments must be owned (String, not &str): they are deserialized from JSON |
two &ToolCtx | at most one &ToolCtx parameter |
#[args] with another model argument | #[args] must be the only model argument |
| a bad tool name | tool names must match ^[a-z][a-z0-9_]{0,63}$ |
| an unknown option | unknown #[tool] option aproval; expected one of: name, type, strict, classify, asks_user, paged, crate, step, label, icon, parallel, path, access, retry |
| on a struct or trait | #[tool] goes on an async fn |
Every mistake of one function is reported in one compile. rustc reports the rest, with messages
written for it: an argument type without Deserialize or JsonSchema (“Foo cannot be a #[tool]
argument”), and a return type that is not a tool result.
§Tests
crates/adam-macros/src/expand.rs: unit tests of the expansion on token streams (every option, every parameter kind, every error message, the doc-comment joining).tests/tool_macro.rs: generated tools through a realLlmAgentandMockModelon the in-memory store: arguments in, output back, bad input, state,try_build, cancellation context,classify.tests/ui.rs:trybuild.tests/ui/pass/*.rsmust compile,tests/ui/fail/*.rsmust fail with the message in the.stderrbeside it (errors the macro produces, stable across toolchains). The errors rustc itself produces (tests/ui/rustc/*.rs) change wording between toolchains, so they run only withADAM_TRYBUILD=1, in the CI job pinned to one toolchain. To regenerate snapshots:TRYBUILD=overwrite cargo test -p adam --test ui(and withADAM_TRYBUILD=1for the rustc ones).- The example above is a doctest.
Re-exports§
pub use adam_agent_fs as agent_fs;pub use adam_assembly as assembly;pub use adam_core as core;pub use adam_error as error;pub use adam_mcp as mcp;pub use adam_model as model;pub use adam_runtime as runtime;
Modules§
- paging
- One convention for every tool that reads:
offsetandlimitin, a page and one last line out. - prelude
- What an agent’s source file usually wants:
use adam::prelude::*;.
Macros§
- include_
agent - Include the agent that
build.rsembedded:adam::include_agent!();at module level. - tools
- Build a
ToolSetfrom tool values, in order:tools![Clock, Search::new()].
Structs§
- Agent
Def - An agent as its files describe it, before it is tied to tools, state and a model.
- Agent
Folder - One agent, read from a folder at run time: the definition, what the load warned about, and the digest that names these exact files.
- Agent
Info - What one bound agent is, without its
LlmAgent(which does not expose it). Two definitions that bind to equalAgentInfos make equal agents; that is how the tests compare an embedded agent with the same files read from a directory. - Approval
- A tool call a
before_toolhook asked a person to approve (ADR 0050, decision 12, slice H8). - Artifact
- A named piece of output produced while a run works (a file, a report, a structured result). A2A maps these to task artifacts.
- Artifact
Ref - Name and media type of an artifact a tool produced (the content itself
lives in
RunView::artifacts). - Assembly
- The agents an
AgentDefmakes: the root and oneLlmAgentfor each local subagent definition, ready to register on a runtime. - Bound
Def - 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. - Compaction
- One compaction of a run, in
Conversation::compactions. - Conversation
- The state of an
LlmAgentrun: the persisted history plus the bookkeeping the loop needs to resume from any commit. - Event
Header - Who an event is about, and when: the part every event carries.
- Event
Queue - Events in the order they happened, held until the flush before a commit.
- Event
Spec - A custom event as it is declared: the name it is emitted under, the version of its data, the JSON Schema of its data (what a consumer reads; the loop bounds the data’s size, it does not validate against the schema) and who may see it.
- Extensions
- A map from a type to one shared value of that type (at most one per type).
- Flush
Report - What a flush did, for a log line and a count. It never changes the run.
- FnTool
- A
Toolmade 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. - FnTool
Builder - Builds a typed
FnTool:FnTool::builder("echo").description("...") .args::<EchoArgs>().handler(|ctx, args| async move { ... }). - Hook
Decision - One decision a hook set made about a call, as the call’s step records it (ADR 0050, decision 2).
- Hook
Error - Why a hook did not decide. A plugin that errors never lets the call through: the set answers this and the caller denies.
- Hook
Event - What an observer receives: a core event with its header and its bounded, scrubbed fields.
- Hook
Limits - How long one hook may take, and how many times a transient failure is tried again.
- HookSet
- An ordered set of plugins, with their limits. A clone shares the plugins (
Arcs): a host that gives one set to several agents (adam_assembly::BoundDef::hooks) runs the same plugins in each. - Hooked
Call - What a call is, as a hook sees it: the tool’s name and the arguments the model sent, which a plugin may rewrite in place.
- Hooked
Compaction - What a compaction is, as a
compaction.beforehook sees it: the context a plugin may add to the summary request. The history, the cut and the model are not here, and a hook never writes the summary itself. - Hooked
End - The answer a run is about to end with, as a
run.endinghook sees it. Read only: a hook never rewrites an answer, it asks for another try. - Hooked
Message - What a person’s message is, as a
message.receivedhook sees it: its text, which a plugin may rewrite in place, and its files by reference. - Hooked
Model Request - What a model call is, as a
model.requesthook sees it: the sampling temperature and top-p, the bound on the answer’s length, the call’s metadata, headers and extra body, and what kind of call it is. A plugin may read the kind and rewrite the rest in place. The system prompt, the history, the model, its endpoint and its key are not here. - Hooked
Output - What the journaled step
tool:<call id>records: what the call answered, beside what the hooks decided about it (ADR 0050, decision 2). - Hooked
Text - What a tool answered, as an
after_toolhook sees it: the text the model will read, which a plugin may rewrite in place. - Image
Gate - The admission rules for one run, from what the history holds now. A call that offers several images shares one gate, so the run’s count is kept across them.
- Image
Outcome - What a tool gets back from
keep_image. - Image
Store - The keeper an agent reaches through its state (
KeptImages). - Inbound
Image - An image as an inbound message carries it: base64
data, and what the sender says of it. Its type and its name are checked, never trusted. ItsDebugsays how long the data is and never prints it. - Json
- Returns
Tto the model as compact JSON text. - Kept
Image - An image a tool wants the run to keep in its own state (
ToolOutput::kept_images): whatkeep_imagehands back when the agent has noImageStore. ItsDebugsays how long the data is and never prints it. - Kept
Info - What a keeper kept.
- Kept
Output - An output a tool wants the run to keep in its state:
textunderid(ToolOutput::kept). - Kept
Store - The keeper an agent’s tools reach through
ToolCtx::state. - Limit
Hit - A
Limitsbound a run reached. - Limits
- Bounds on one run. A run that reaches
max_turnsormax_tool_callsgets one closing model call in which it may call no tool, and ends with that answer markedlimited(the output’slimitedandlimit); 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 (seemax_history_tokens). - Line
Folder - Folds a streamed text the way
preparedoes, a piece at a time: a line overMAX_LINE_CHARScharacters is folded onto several, a NUL is U+FFFD, and only complete lines are returned, so that a file written from them never ends in the middle of one (the pages of the lines already there do not change when more is written). - Listing
- What a
ToolSourceoffers for one model turn: the tools, and what it says about them (ToolNote). - Live
Assembly - The agents of a directory, reloaded when its files change. Only with the feature
dev. - Live
Builder - Builds a
LiveAssembly. Made byLiveAssembly::builder; the hooks are the things a startup does between the stages, and they run again, in order, on every reload. - LlmAgent
- A durable LLM tool-calling agent: instructions + a model + a toolset.
- LlmAgent
Builder - Configures an
LlmAgent. Start withLlmAgent::builder. - LlmStarter
- The start-only half of an
LlmAgent: it turns the first user message into theConversationa run starts with, and needs neither a model nor tools. - Loaded
- One group of tools a run has loaded, as the loader that loaded it recorded it.
- Loader
- A loader the run may still call: its name, and the tools a call would make available.
- Memory
Images - Everything a
KeptImagesstore must do (kept_images_conformanceasserts it). - Memory
Kept - A
KeptOutputsin memory, for tests and for the conformance of the trait. - Message
Decision - What the step that takes a person’s message in records (
message.received, ADR 0050 decision 9). - Message
File - A file a person sent with a message, as a
message.receivedhook sees it: by reference, never its bytes. - Model
Binding - The model a run’s call may be bound to besides the agent’s own, with what its profile resolves for it: the alias, the output cap and the default reasoning level (ADR 0064, amended 2026-11-23).
- Model
Parking - How a run waits on a model that refused it, or could not be reached
(
LlmAgentBuilder::model_parking). - Model
Switch - A run’s switch to its agent’s fallback model: the model the endpoint refused, the one the run continues on, and the turn the refusal came at.
- Model
Wait - The model call a run waits to make again (
Conversation::model_wait). - Observe
Limits - How long an observer may take, per event and for a whole flush.
- Origin
- Where a problem comes from: the agent, by its registration name (
coder,coder/reviewer), and the file of the manifest that says it, relative to the source root (agent/instructions.md,agent/subagents/reviewer.md). - Pending
Question - A tool call that asked the user a question and waits for the answer.
- Pending
Remote - A tool call that waits for a task on another system to finish.
- Pending
Run - A tool call that waits for a child run to finish.
- Pending
Session - A tool call that waits for the round of a child session to end (ADR 0045).
- Plan
- The plan of a conversation: items in display order, under an optional title.
- Plan
Item - One line of the plan.
- Prompt
Size - How big the last model call’s prompt was, as the provider reported it, and how many messages the history held when it was made: the estimate of the next one starts from it.
- Read
Output read_output { id, offset?, limit? }: reads a kept output page by page.- Recorded
Event - A custom event as the step that emitted it records it.
- Refusal
- Why an answer is not used, and the question that takes its place: see
AnswerCheck::Refuse. - Reloaded
- What a successful reload did.
- Remote
Info - A remote (A2A) subagent found in the files, as data. Its tool is in the parent’s
AgentInfo::tools, made byAgentDef::bindwith the URL and the token checked; this is what the files said. - Repeats
- The last tool call of a run and how often in a row it has given the same answer: what the
doom_looprule reads. Both fields are hashes (the call’s tool name and canonical arguments, and the result’s content and error flag), so the state holds no copy of either. - Session
Agent - One subagent a session may be started on.
- Session
Tools - The five session tools, for the subagents of one agent.
- Source
Ctx - What a
ToolSourcesees of the run when the model is about to be called. - State
- Shared state as a tool sees it: a cheap-to-clone handle to a
Tthat the agent was given withLlmAgentBuilder::state. Derefs toT. - State
Image - What a state-kept image is: its type and its bytes in base64. Its
Debugsays how long the data is and never prints it. - State
Key - Names one type of shared state: what
Tool::required_statereturns, and whatLlmAgentBuilder::try_buildchecks against the agent’sExtensions. - Step
Event - One report about a step: it started, moved, or ended.
- StepIo
- How a tool call’s step reports its input and output: what is scrubbed first, and how much is kept.
- Step
Output - What a step’s call answered, bounded by the contract (
steps/v1’soutput). - Step
Style - How a tool call is drawn as a step: see
Tool::step_style. - Stream
Scrubber - Scrubs an output as it streams, so that what is written is exactly the scrub of the whole and no secret is ever on disk in part.
- Subscriptions
- What an observer wants to be told: the core catalogue, patterns, or nothing.
- ToolCtx
- What a tool sees of the run it executes in.
- Tool
Note - What a
ToolSourcesays, when it lists a tool, about how a call to it is carried out: not for the model, for the agent and for the source’s owncalllater. - Tool
Output - What a successful tool call returns.
- ToolSet
- An ordered group of tools, built once and handed to an agent.
- Typed
FnTool Builder - The second half of
FnToolBuilder: the arguments are known, the closure is not. - Use
- One thing a call uses, and how.
- Withheld
- A tool a
ToolSourceholds back on one turn, and what to tell the model if it calls it anyway.
Enums§
- Admission
- What became of an image offered to the model.
- Alias
Problem - Why a model alias was refused.
- Answer
Check - What a tool says about an answer to its own question: see
Tool::read_answer. - Assembly
Error - Why an
AgentDefcould not be bound to agents. - Build
Error - Why
LlmAgentBuilder::try_buildrefused to build an agent. - Compaction
Reason - Why a history was compacted.
- Declaration
Error - Why a declaration or a subscription is refused. Every case is a build error: the class is
[
ErrorClass::Invalid], and a binary exits 78 on it. - Emit
Error - Why
ToolCtx::emit_eventrefused an event. Nothing was recorded, and nothing will be sent. The class is [ErrorClass::Invalid]: the tool is wrong, and trying again changes nothing. - Event
Kind - A core event of the catalogue (ADR 0050, decision 5): the ones an observer reads.
- Image
Keep Error - Why an image could not be kept or loaded. The text is for logs and for a stand-in.
- Kept
Error - Why a kept output could not be kept or read. The text is for the model.
- Limit
Kind - Which
Limitsbound a run reached. Serialised as the bound’s name. - Model
Call Kind - Which model call a
model.requesthook runs at. - Model
Park - How a run parked on the model wakes.
- Pending
Wait - What a parked run is waiting for, so that one result can complete the call that owes it.
- Plan
Status - Where an item stands.
- Reload
Error - Why a reload changed nothing. The last good version stays in force.
- Remote
Poll - What
Tool::poll_remotefound. Journaled, hence serializable. - Step
Icon - The picture a step is drawn with: the contract’s vocabulary, and nothing else (an icon the screen does not know is ignored there, so a closed set is what an agent can mean).
- Step
Kind - What kind of work a step is.
- Step
State - Where a step stands. The last three end it.
- Template
Problem - What is wrong with the
{{a template contains. - Tool
Access - What a call shares with the other calls of its turn: see
Tool::access. - Tool
Error - Why a tool call did not produce an output.
- UseMode
- Whether a call reads or changes what its scope names.
- Verdict
- What a deciding hook says about the call it runs at.
- Visibility
- Who may see a custom event.
Constants§
- ACCESS_
TIER_ CONTEXT_ KEY - The context key under which a message carries the access tier the person picked for it
(
access-tier/v1):{"tier": "plan" | "edits" | "auto" | "bypass"}. - AFTER_
PREVIOUS - The reserved argument name.
- AFTER_
PREVIOUS_ INSTRUCTION - What the instructions say about
AFTER_PREVIOUS: the sentence appended to them (after a blank line) when the limit is above 1. Exported asAFTER_PREVIOUS_INSTRUCTION, so a test can tell it from the agent’s own words. - AGENT_
DIR_ ENV - The environment variable that names the agent folder to read at run time:
ADAM_AGENT_DIR=/etc/adam/agent. - CALLER_
CONTEXT_ KEY - The context key under which a message says who it was sent for (
thread-tools/v1): the thread’s addressed agent,{"caller": "main"}, or an agent another agent asked,{"caller": "ask:<n>", ..}, read from the claims of the grant’s token. A run of an asked agent has no person behind it, which is a limit on what it may ask for. - CHILD_
SESSIONS_ CONTEXT_ KEY - The context key under which a message says its client shows child sessions
(
child-sessions/v1activated):true, written by the A2A front, and cleared by a message that did not activate the extension. It is what lets a session the model starts be one the person sees: a round of a kept-open session asks the person only when the header says they see it (SessionHeader::visible, ADR 0045 decision 9). Not one ofPROTECTED_CONTEXT_KEYS: a context too large to keep it makes a child unable to ask, which is the safe way to lose it. - CLOSING_
TURN - What the model is asked in the closing turn, the last model call of a run that reached
max_turnsormax_tool_calls. Sent after the history, as a user message that is not kept in it. - COMPACTION_
BEFORE - The point where a history is about to be summarised, inside the summary’s journaled step (ADR 0050, slice H9).
- COMPACTION_
TURN - The instruction a summary request ends with: the request as it stands, then this as one more user
message, with
tool_choice: none. A request is a summary request when its tool choice isToolChoice::Noneand its last message’s text ends with this (the closing turn also usesnone, with another text). - DATA_
MAX - The most data one custom event carries, serialized, in bytes: 4 KiB.
- DEFAULT_
MAX_ PARALLEL - The most tool calls of one turn that run at the same time unless
LlmAgentBuilder::max_parallelsays otherwise. - DEFAULT_
MODEL_ PARK_ LIMIT - How long parks on a timer in a row may last, from the first of them, unless
ModelParking::limitsays otherwise: 24 hours. - DEFAULT_
TOOL_ TIME_ LIMIT - The longest a call of a tool that declares no
Tool::time_limitmay run: 300 s. - DEFAULT_
WAIT_ POLL - How long a run waiting for a child run sleeps before it looks at the child itself, unless
LlmAgentBuilder::wait_pollsays otherwise. - EXTRA_
MCP_ FILE_ ENV - The environment variable that names a file of extra MCP servers, in the shape of
mcp.json({"mcpServers": {...}}), to add to the agent’s own at startup:ADAM_EXTRA_MCP_FILE=/etc/adam/extra-mcp/mcp.json. It adds servers to the folder’smcp.json(or to the embedded copy’s) and never replaces one: seeAgentDef::with_extra_mcp_file. - GROUP_
LOADER_ PREFIX - The prefix of a group loader’s tool name:
load__group__<name>. - IMAGES_
KEY - The member of an inbound payload that holds its images:
[{"name", "mediaType", "data"}]. - LOCALE_
CONTEXT_ KEY - The context key under which a message carries the person’s interface language
(
locale/v1, ADR 0069): the BCP 47 tag the client sent with that message, as a string ("fr-FR"). It is the language the agent’s own words are written in, unless the person writes in another one. A message that names none clears it, so a run never answers in the language of a message that is no longer the newest. - MAX_
CARRIED_ BYTES - The most serialized JSON, in bytes, of messages that a continued conversation carries from the
conversation it continues (
Conversation::continued): 256 KiB. - MAX_
COMPACTIONS - The most compactions one run makes; after that the history is only shortened. What a run that
continues another carries (
Compaction::carried) does not count. - MAX_
CONTEXT_ BYTES - The most serialized JSON, in bytes, that a conversation’s
contextmay hold: 256 KiB. A message whose context would take it over is read for its text and its context is dropped, with a warning. - MAX_
DESCRIPTION_ CHARS - The most characters of a session’s description.
- MAX_
INBOUND_ IMAGES - The most images one inbound message carries into a run. The inbox is in the run’s durable state until the message is read, so what a message may carry is bounded.
- MAX_
INBOUND_ IMAGE_ BYTES - The most bytes of images one inbound message carries into a run.
- MAX_
INTERFACE_ LANGUAGE_ BYTES - The most bytes of a tag this module prints:
adam_a2a::Locale’s bound, restated here because this crate does not depend on the A2A layer. - MAX_
KEPT_ BYTES - The most bytes of one kept text.
- MAX_
LOADED_ NOTE_ BYTES - The most bytes a
Loaded::noteholds: one line of the marker a compaction writes. - MAX_
MODEL_ BACKOFF - The longest step of the backoff of parks on a timer: 15 minutes. A park the endpoint asked to be
longer (
Retry-After) is that long. - MAX_
OPEN_ SESSIONS - The default of [
SessionLimits::max_open]: the most sessions of one conversation that may be open at once (not closed). A start past it is refused. - MAX_
PARALLEL_ LIMIT - The most
LlmAgentBuilder::max_parallelaccepts: a larger value is this. - MAX_
PLAN_ ITEMS - The most items a plan holds.
- MAX_
PROTECTED_ VALUE_ BYTES - The most serialized JSON, in bytes, that the value of a
PROTECTED_CONTEXT_KEYSkey may hold. - MAX_
READ_ IDS - How many ids a run remembers having read (
Conversation::read_ids: messages and forwarded resumes together). A person does not steer a task a hundred times, and the oldest id is the one given up, so a retry of an old message is the only thing this can let through. - MAX_
REPORTED_ ROUNDS - How many rounds a run remembers having reported (
Conversation::reported_rounds): the oldest is given up. A round given up that is still due is not told again if its report is still in the history (its call id is there); one whose report was compacted away may be told once more. - MAX_
RUN_ JOURNALED_ IMAGE_ BYTES - The most bytes of images that the tool steps of one run journal, for an agent with no
ImageStore(a folder agent): the run’s artifact budget. Counted over the run and never freed by a shortening or a compaction, because what was journaled stays journaled. - MAX_
RUN_ KEPT_ BYTES - The most bytes a run keeps in its own state (
Conversation::kept_outputs). - MAX_
SCOPE_ IMAGE_ BYTES - The most bytes of images a scope keeps on a volume (
KeptImagessays it again for its own). - MAX_
SESSION_ ROUNDS - The default of [
SessionLimits::max_rounds]: a send past it is refused (a close never is, so a session can have one more round, the closing one). - MAX_
SOURCE_ TOOLS - The most tools the sources of an agent may offer on one model turn, all sources together. The ones past it are left out, with a warning: a source that lists without bound would fill the model’s context with tool definitions.
- MAX_
TEXT_ CHARS - The most characters of a
promptor amessage. - MAX_
THINKING_ CUTS - How many turns in a row may end at the output limit with reasoning only before the run fails
(each is continued with
THINKING_CUT_TURNand counts as a model call againstmax_turns). A turn with words or a tool call starts the count again. - MAX_
WORKING_ ROUNDS - The default of [
SessionLimits::max_working]: the most rounds of one conversation that may work at once. A start, or a send that would start a round, past it is refused. - MESSAGE_
KIND - Recommended [
Inbound::kind] of a user message. The agent does not inspect the kind: anything whose payload parses (seeuser_message) is a user message. - MESSAGE_
RECEIVED - The point where a person’s message is about to reach a model (ADR 0050, decision 9). It may
allow the message, rewrite
HookedMessage::textin place, or refuse it withVerdict::Deny. - MODEL_
CONTEXT_ KEY - The context key under which a message names the model its run is asked of:
{"model": "<alias>"}, an alias the agent was given a profile for (LlmAgentBuilder::model_choices); the engine’sSay::modelsets it. It holds for the run until a later message names another. Not a protected key, and ignored by an agent given no choices (ADR 0064, amended 2026-11-23). - MODEL_
REQUEST - The point where a model call is about to be made, inside the call’s step (ADR 0050, slice H3).
- MODEL_
RESUME_ KIND - The
Inbound::kindof a resume: a message that wakes a run parked on the model and adds nothing to its conversation (ADR 0067 decision 4). The A2A server delivers one for a message whose metadata holdsadam.resume: true; the loop reads none of its payload. It is the runtime’s wake-only kind ([adam_runtime::RESUME_KIND]): one that lands while the run works neither counts as a message that arrived nor reopens a run that finishes. - MODE_
CONTEXT_ KEY - The context key under which a message picks the mode its run works in (
agent-mode/v1, ADR 0039 decision 3):{"mode": "<name>"}, one of the modes the agent’s folder declares. It holds for the run until a later message picks another, and a mode only narrows: the tools it does not list are withheld, and the access tier still caps every one it does. - NOT_
APPROVABLE - The result of a call a
before_toolhook asked a person to approve, in a run nobody can approve it in: a child run that may not ask the person (ADR 0045 decision 9) or a firing of a schedule. Such a run readsAskasDeny(ADR 0050, decision 12, slice H8), and the step records adeny. - NOT_
ASKABLE - The result a tool that asks the person gets in a child run that may not ask (ADR 0045 decision
9): only a round of a kept-open session that a client shows (
child-sessions/v1) has somebody to answer it, so the model is told to go on and say what it needs in its report. - OMITTED_
MARKER_ PREFIX - How the text of the marker that stands in for dropped turns begins. The marker is the second
text part of the first user message (
Conversation::omitted_turnssays it is there), so a reader that looks at what the user said, such as the coder’s rule about which repositories a task named, can skip it by this prefix. - PER_
MESSAGE_ CONTEXT_ KEYS - The context keys that speak for one message only: a message sets them or, by saying nothing,
clears them. When a message’s context is over
MAX_CONTEXT_BYTESand dropped, these are deleted (neither the earlier value nor the update stays), so a run never acts on what an earlier message offered: a turn whose offer was lost draws nothing. - PROMPT_
STATEMENT_ KEY - The key of an inbound payload that carries the prompt statement and the person’s envelope
(
prompt-statement/v1, ADR 0077):{"statement": "<JWS>", "user"?: "<JWS>"}. The A2A front writes it from a message whose request activated the extension (and removes it otherwise), andToolCtx::start_childand the session tools write the run’s own into a child’s or a round’s first message. The run keeps it inConversation::prompt_statement, never in its context. - PROTECTED_
CONTEXT_ KEYS - The context keys that must survive a context the run drops: the limits on the agent (the
access tier the person picked, the mode it works in, who the message was sent for, the reasoning
effort it activated, and that nobody answers the run,
adam_runtime::UNATTENDED_CONTEXT_KEY) and the interface language the person is speaking (LOCALE_CONTEXT_KEY). A message always sets them, even when the rest of its context is overMAX_CONTEXT_BYTESand dropped (otherwise a large catalog next to aplantier would lift the limit, or the agent would answer in a language it picked itself), and a child run starts with the ones its parent has (ToolCtx::start_child). Each value is at mostMAX_PROTECTED_VALUE_BYTES; a larger one is ignored. - READ_
OUTPUT - The tool that reads a kept output.
- REASONING_
EFFORT_ CONTEXT_ KEY - The context key under which a message carries the reasoning effort it activated
(
reasoning/v1, ADR 0063):{"effort": "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max"}. The newest message’s value is the run’s effort from the next model call; a continuing task and a child run inherit it. A value that is not that shape is ignored here: the front refuses it before anything is written. - REDACTED_
MARKER - What replaces a secret where it is removed.
- RENDERER_
OFFER_ CONTEXT_ KEY - The context key under which a message says what its renderer offers this turn (A2UI v1.0
a2uiRendererCapabilities):{"catalogIds": [...]}. - RESERVED_
LOADER_ PREFIX - The prefix the group loaders reserve:
load__group__<name>(ADR 0066, decision 2). A tool of an MCP server or of a conversation whose full name starts with it is left out with a warning, and a registered tool whose name starts with it is refused at bind, because an MCP tool is<server>__<tool>and the names would collide. - RESERVED_
NAMESPACES - The namespaces of the core catalogue: no declared event may start with one of them (checked on the first segment, without regard to case).
- SCRUB_
OVERLAP - What a producer captures beyond
MAX_KEPT_BYTES(and before a tail it shows), and the margin a keeper cuts back at the edge of a text that was cut (scrub_open_end). No secret is longer. - SESSION_
TOOLS - The five tool names, in the order the model is offered them.
- SESSION_
TOOL_ TIME_ LIMIT - The time limit each session tool declares (
Tool::time_limit). None of them does long work: a read that waits parks the run and returns at once. - SHORTENING_
FLOOR - A tool result shorter than this many characters is never shortened: small structured results hold ids nothing else repeats (a session’s, a plan’s, a shared file’s), and they are not what fills a history.
- STEP_
EVENTS_ MAX - The most custom events one step (one tool call) emits: 16.
- STOPPED_
BY_ THE_ PERSON - What a tool call that was still owed when its run ended is told, in a continued conversation: the result the model reads in place of the one it never got.
- SUBAGENT_
CLOSE - The name of the tool that closes a session.
- SUBAGENT_
LIST - The name of the tool that lists the sessions.
- SUBAGENT_
READ - The name of the tool that reads the report of a session.
- SUBAGENT_
SEND - The name of the tool that sends a message to a session.
- SUBAGENT_
START - The name of the tool that starts a session.
- THINKING_
CUT_ TURN - What the model is told after a turn that reached the output limit while it was still thinking: no words and no call, only reasoning. Kept in the history after that turn, except when the next turn is the closing turn.
- TOOL_
STOP_ GRACE - How long a call that is past its time limit has to stop by itself, once its
ToolCtx::cancelledtoken has fired, before its future is dropped. - TRANSITION_
EVENTS_ MAX - The most custom events one transition emits, across all its calls: 256.
- TRUNCATION_
MARKER_ PREFIX - Prefix of the marker appended to a truncated tool output. Public through the crate root so callers and tests can recognise truncation.
- UNATTENDED
- The result a tool that asks the person gets in a run nobody answers, a firing of a schedule (a
conversation under
adam.schedule:, ADR 0060): the run cannot wait for an answer, so the model is told to go on without one. - WINDOW_
MARGIN_ TOKENS - The tokens a window keeps free of the history: the answer, the tools’ own growth and the estimate’s error.
Traits§
- Into
Manifest - Something an
AgentDefcan be made from: the owned manifest that a directory produces, or the'staticone thatbuild.rsembeds. Both end up as the same [AgentManifest], so an agent binds the same way wherever its files came from. - Into
Tool Output - A value a tool can return as its output.
- Into
Tool Result - What a tool function returns, as the
Tool::callresult: anyIntoToolOutput, or aResultof one with an error that isInto<ToolError>. - Kept
Images - A place that keeps the bytes of images. Put in the agent’s state as an
ImageStore. - Kept
Outputs - A place that keeps outputs for
ReadOutput. Put in the agent’s state as aKeptStore. - Plugin
- A compiled hook set around one tool call. Every method has a do-nothing default, so a plugin that cares about one point implements one method.
- Tool
- A capability the model may call.
- Tool
Source - A group of tools the agent learns about while it runs, not when it is built: what a caller says it can offer in the messages it sends (the endpoint for a thread’s tools, for instance), read again at every model turn.
- Tool
Spec Ext ToolSpec::for_args::<A>(name, description):spec_foras an associated function.ToolSpecbelongs toadam-model, so this is an extension trait: import it to call it.
Functions§
- agent_
dir - The directory to read:
AGENT_DIR_ENVwhen it is set and not empty, elsedefault. - agent_
dir_ from_ env AGENT_DIR_ENVwhen it is set and not empty (surrounding whitespace does not count as a value), elseNone: the caller then uses the copy it has embedded, or refuses to start.- approval_
step - The journaled step that runs a call a person approved (ADR 0050, decision 12, slice H8):
tool:<call id>:approved. It is taken only after a recordedAskand the person’s yes, so its seq never depends on which plugins are configured; a replay that finds it recorded runs nothing. - approves
- Whether a person’s answer to an approval is a yes: one of
yes,y,approve,approved,allow,ok,okay, without regard to case, surrounding space or a final.or!. Anything else is a no (ADR 0050, decision 12): a call runs only on a clear yes, and the words of any other answer are the reason the call is refused with. - call_
key - What a call is called within its root run: its call id, and for a subagent’s call its own run before it (a call id is only unique within the run that made it).
- canonical_
pointer_ id - The id of a line that is exactly
pointer_lineof a well-formed id. - count_
lines - Count the lines of a prepared text.
- extra_
mcp_ file_ from_ env EXTRA_MCP_FILE_ENVwhen it is set and not empty, elseNone: there is nothing to add.- find_
pointer - Where in
textthe line is that points to the kept outputid: the byte range (without the newline) of the first line with the shape of what the kept-output code writes (kept_header, and the closing line of a command’s view): it starts with[, ends with]and holdsread_output {"id":"<id>"}. A line that only mentions the words, or names another id, is none.idis the one of the call whose resulttextis, so text that a tool copied from somewhere (a file, a page) cannot name one. - image_
scope - The scope that keeps the images of a conversation: 32 hex digits of a SHA-256 of its id, so a task that continues it still sees what the person sent; with no conversation id, of the root run’s id. The id itself is never a file name.
- interface_
language - The interface language a run’s context names (
LOCALE_CONTEXT_KEY), when it is one to print: a string of at mostMAX_INTERFACE_LANGUAGE_BYTESbytes of ASCII letters, digits or-(the characters of a BCP 47langtag). A value that is anything else is ignored and nothing is sent, so nothing a tool wrote can become a line of the prompt. - interface_
language_ turn - What the model is told about the language the person’s interface names (
locale/v1, ADR 0069). Sent before the closing turn, as a user message that is not kept in the history, and never insystem: the stable prefix of ADR 0044 keeps its bytes, so a provider’s prompt cache still hits, and the language belongs to the message that named it. - is_hex
- Whether
textislenlower-case hexadecimal digits. - is_
ordinary_ word - Whether
needleis an ordinary word: lowercase ASCII letters only, so that it can stand as an identifier in code (postgres,password). Only such a value takesis_value_position; a token with a digit, a capital,_,-or a Base64 form cannot be an identifier, so it is replaced wherever it stands. - is_
output_ id - Whether
idhas the shape of an output id:o-and 16 lowercase hex characters. - is_
unattended - Whether nobody answers a run: a firing of a schedule (its conversation is under
adam.schedule:), or a child of one (its context carriesadam_runtime::UNATTENDED_CONTEXT_KEY, which the scheduler sets and children inherit). - is_
value_ position - Whether
text[at..at + len]stands where a value stands: at the start or end of the text, or between bytes that cannot be part of an identifier, and not as the scheme of a URL (postgres://…). - keep_
image - Admit and keep the image
bytesoffered by the call ofctx, and say what the model is shown (ImageOutcome). Likekeep_long: with anImageStorein the agent’s state the bytes go there (by the SHA-256, once, for the conversation); without one they go back inToolOutput::kept_imagesfor the loop to keep in the run’s state. A model that cannot see, a source the deployment does not allow, a type, a size or a count over its limits are a stand-in line, never an error. - keep_
long - Keep a long
textfor the call ofctxand say what the model is shown: the first page and an id to read the rest withReadOutput, or, when it cannot be kept, the first page and why the rest is lost. The second value is what the loop keeps in the run’s state (ToolOutput::kept); it isSomeonly when noKeptStoreis in the agent’s state. - keep_
long_ cut keep_longfor atextthat is the first part of a result of whichomittedmore bytes were left out. A keeper cuts such a text back at its end (KeptOutputs::keep); with no keeper the context’s scrub hook (ToolCtx::with_scrub) does.- kept_
header - The line that opens what the model is shown of a kept text: the id, how long the text is, and
that
read_outputreads it. - kept_
images_ conformance - What every
KeptImagesdoes: keeps what it is given and gives it back, once for the same bytes; refuses an id that is not a hash, a scope that is not 32 hex digits, and bytes that are not the hash they come with; never serves one scope’s image to another; and loads nothing it cannot prove has the hash it was kept under. For an implementation’s own tests:tamperrewrites what was kept under(scope, sha256)the way a local command could, and isNonefor a keeper that cannot be changed behind its back. - kept_
outputs_ conformance - The conformance of a
KeptOutputs: whatReadOutputand the tools that keep rely on. Call it from a test of an implementation (it panics on a violation). - kept_
view - What the model is shown of a text that was kept:
kept_header, the first page, and the page’s final line ([more: ...; next page: offset=N]). - loaded_
note noteas aLoadedkeeps it: one line (a line break or a Unicode line separator could forge a line of a compaction’s marker), at mostMAX_LOADED_NOTE_BYTESbytes, ending with an ellipsis when it was cut.adam-assembly’s groups use it, and the loop applies it to a note a custom loader wrote.- output_
id - The output id of a call:
o-and the first 16 hex characters of the SHA-256 of the root run and the call’s key, so a call that runs again keeps under the same id. An id is not a secret: what keeps a run from another’s output is thatReadOutputtakes the run from the call’s context. - output_
id_ of - The id of the output kept by the call of
ctx. - page_of
- A page of a prepared text, as
KeptOutputs::pagerenders it. - parse_
args - Read the model’s argument object into
A. - path_
scope - The scope of a path argument under
base:base/<path>with the path trimmed (the tools trim it before they open it) and normalised lexically (a leading./, a.or an empty component, and a trailing/are dropped), andbaseitself when there is no path, when it names nothing but the root, when it is absolute, or when it has a..component (it may leave the place the scope names, so it widens to all ofbase). - pointer_
line - The one line a shortened history keeps to say how to read the kept output
id: written from the id alone, never copied from a result. - prepare
textas it is kept, for an output of whichomittedbytes were left out before: at mostMAX_KEPT_BYTESof it (cut on a character boundary), a NUL as U+FFFD, and every line overMAX_LINE_CHARScharacters folded onto several lines, so that paging by lines loses nothing. When the output was longer than what is kept (omittednot 0, ortextover the bound) the kept text ends with a line that says how much is kept, and the flag is set.- read_
pointer - The canonical pointer line (
pointer_line) whentexthas a line for the kept outputid(find_pointer). A shortening of a history keeps this line, so the id outlives the cut. - scrub_
open_ end text, which is only the first part of a longer output, scrubbed withscruband cut back so that no part of a secret is left at its end.- scrub_
open_ start scrub_open_endfor a text that is only the last part of a longer output: scrubbed, and without a part of a secret at its start.- scrubbed_
for_ keeping - What a keeper makes of the
textit is given, before it cuts and folds it: scrubbed withscrub, and, whenomittedis not 0 (the text is the first part of a longer output), cut back at its end byscrub_open_endwithmargin(the longest valuescrubreplaces). With theomittedto keep: what was left out, counted again for what the cut back took (never 0 for a text that was cut). - sha256_
hex - The SHA-256 of
bytesas 64 lower-case hexadecimal digits. - spec_
for - The [
ToolSpec] of a tool whose arguments areA: itsparametersare the JSON Schema ofA. - summary_
output_ tokens - The output tokens a summary asks for, given the cap the run’s own calls ask (ADR 0064 decision
3): a run capped below 4,096 gets a summary capped the same way, and one that leaves the cap to
the model (
0) keeps the summary’s own 4,096, because a summary is bounded by the loop. - tool_
retry_ key - The key a tool’s failures count under:
tool:<name>, the name and never the call id, so a tool called again in a later turn counts as the same step (ADR 0061, decision 3). - unkept_
view - What the model is shown of a text that could not be kept: its first page, and a last line that says why the rest is lost.
- user_
message - An inbound user message: kind
MESSAGE_KIND, payload{"text": "..."}. - user_
message_ with_ images - An inbound user message of
textwithimages: kindMESSAGE_KIND, payload{"text": ..., "images": [...]}. At mostMAX_INBOUND_IMAGESimages andMAX_INBOUND_IMAGE_BYTESbytes are read from it.
Type Aliases§
- DynTool
- A shared, type-erased
Tool. - DynTool
Source - A shared, type-erased
ToolSource. - Hook
Result - What a hook answers: a verdict, or the reason it could not decide.
- KeptMap
- The kept outputs of a run’s own state, as a map (see
Conversation::kept_outputs). - State
Images - The images of a run’s own state, by SHA-256.
- Tamper
- A function that rewrites what a keeper holds under
(scope, sha256)the way a local command could.
Attribute Macros§
- tool
#[tool]: anasync fnbecomes aTool. See the crate docs. Turns anasync fninto a tool: keeps the function, and generates a unit struct (the function’s name inUpperCamelCase) that implementsadam::Tool.