pub struct Options { /* private fields */ }Expand description
Settings for an AgentCat handle. Options::default turns on the
context parameter, tracing and the get_more_tools tool, and turns off agent tracking; each
setter consumes the options and returns them changed.
use agentcat_sdk::Options;
let options = Options::default()
.enable_agent_tracking(true)
.custom_context_description("Say why you call this tool.");The four hooks (resolve_session_id, identify, event_tags, event_properties) are async
closures over a ToolCall. The SDK starts them on the tokio runtime that serves the call and
never waits for them, so a slow hook cannot delay a tool call. A hook that returns an error or
None gives nothing. rmcp’s local feature is not supported, because hooks run as Send
tasks.
Implementations§
Source§impl Options
impl Options
Sourcepub fn resolve_session_id<F, Fut>(self, hook: F) -> Self
pub fn resolve_session_id<F, Fut>(self, hook: F) -> Self
Decides the session of each tool call (hook mode). With this hook set, tools get no
session_id parameter and the SDK mints nothing back to the agent. The hook returns the
session id, or None to let the SDK mint one.
Sourcepub fn identify<F, Fut>(self, hook: F) -> Self
pub fn identify<F, Fut>(self, hook: F) -> Self
Says who made each tool call. The hook runs on every call; None leaves the call
anonymous.
Adds the returned tags to the event of each tool call.
Sourcepub fn event_properties<F, Fut>(self, hook: F) -> Self
pub fn event_properties<F, Fut>(self, hook: F) -> Self
Adds the returned properties to the event of each tool call.
Sourcepub fn api_base_url(self, url: impl Into<String>) -> Self
pub fn api_base_url(self, url: impl Into<String>) -> Self
The base URL of the AgentCat API, in place of the environment’s and the default. An empty
text means none is set. The URL is used as given.
Sourcepub fn redact_sensitive_information<F, Fut>(self, hook: F) -> Self
pub fn redact_sensitive_information<F, Fut>(self, hook: F) -> Self
Redacts every string of each event before it leaves the process: the hook gets one string at a time and returns the string to send. It runs on the tokio runtime that serves the call. When it fails, the SDK drops the event rather than send it unredacted.
The SDK gives the hook no time limit. An event holds one of the 5 delivery slots of its handle while the hook runs on it. A hook that never completes holds its slot for good, and five such hooks stop the delivery of the handle: later events wait in the queue until a shutdown abandons them.
Sourcepub fn redact_event<F, Fut>(self, hook: F) -> Self
pub fn redact_event<F, Fut>(self, hook: F) -> Self
Changes each event before it leaves the process: the hook gets the whole Event and
returns the event to send, or Ok(None) to drop it. It runs on the tokio runtime that
serves the call. When it fails, the SDK drops the event. To unit-test the hook, call it
with an event from Event::default.
The SDK gives the hook no time limit. An event holds one of the 5 delivery slots of its handle while the hook runs on it. A hook that never completes holds its slot for good, and five such hooks stop the delivery of the handle: later events wait in the queue until a shutdown abandons them.
Sourcepub fn log_destination(self, destination: LogDestination) -> Self
pub fn log_destination(self, destination: LogDestination) -> Self
Where the SDK writes its own log lines. The first handle built in the process decides. The
default is LogDestination::File.
Sourcepub fn enable_report_missing(self, on: bool) -> Self
pub fn enable_report_missing(self, on: bool) -> Self
Whether tool listings get the get_more_tools tool, through which agents report a tool
they miss.
Sourcepub fn enable_tracing(self, on: bool) -> Self
pub fn enable_tracing(self, on: bool) -> Self
Whether tool calls are recorded and tools get the session_id parameter. With tracing
off, tools get neither session_id nor agent_id (also with agent tracking on), and
nothing is recorded; tools still get the context parameter and get_more_tools. Each
call goes to the tool without the parameters the SDK added to it, as with tracing on, so a
tool that declares its own context keeps it.
Sourcepub fn enable_tool_call_context(self, on: bool) -> Self
pub fn enable_tool_call_context(self, on: bool) -> Self
Whether tools get a required context parameter, in which agents say why they call the
tool. The text is recorded as the intent of the call.
Sourcepub fn enable_agent_tracking(self, on: bool) -> Self
pub fn enable_agent_tracking(self, on: bool) -> Self
Whether tools get a required agent_id parameter, with which agents identify themselves.
Only with tracing on (enable_tracing).
Sourcepub fn custom_context_description(self, text: impl Into<String>) -> Self
pub fn custom_context_description(self, text: impl Into<String>) -> Self
The description of the context parameter that agents read. An empty text means the
default description.