pub struct HarnessOptions { /* private fields */ }async-client only.Expand description
How to launch and configure a harness session.
This carries both halves of startup: the InputConfig written over stdio
during the handshake, and the HarnessConfig sent as the first WebSocket
frame. Most callers only touch the latter.
Implementations§
Source§impl HarnessOptions
impl HarnessOptions
Sourcepub fn new() -> Self
pub fn new() -> Self
Default options: read-only built-in tools, no models, no workspace.
A workspace and at least one model still need setting — a harness with no model exits during initialize.
Sourcepub fn binary(self, path: impl Into<PathBuf>) -> Self
pub fn binary(self, path: impl Into<PathBuf>) -> Self
Overrides binary discovery with an explicit path.
Sourcepub fn storage_directory(self, path: impl Into<PathBuf>) -> Self
pub fn storage_directory(self, path: impl Into<PathBuf>) -> Self
Where the harness persists conversation state between runs.
Leave unset for an ephemeral session.
Sourcepub fn workspace(self, directory: impl AsRef<Path>) -> Self
pub fn workspace(self, directory: impl AsRef<Path>) -> Self
Adds a directory the agent is allowed to read and write.
Sourcepub fn model(self, model: ModelBuilder) -> Self
pub fn model(self, model: ModelBuilder) -> Self
Adds a model. Call more than once to register several.
Sourcepub fn system_instructions(self, instructions: SystemInstructions) -> Self
pub fn system_instructions(self, instructions: SystemInstructions) -> Self
Sets the system prompt, replacing the harness’s built-in identity.
Sourcepub fn cascade_id(self, id: impl Into<String>) -> Self
pub fn cascade_id(self, id: impl Into<String>) -> Self
Resumes, or creates, a conversation by id.
Sourcepub fn continuation_mode(
self,
mode: HarnessConfigSessionContinuationMode,
) -> Self
pub fn continuation_mode( self, mode: HarnessConfigSessionContinuationMode, ) -> Self
Chooses how an existing cascade_id is treated.
Sourcepub fn tool(self, tool: Tool) -> Self
pub fn tool(self, tool: Tool) -> Self
Declares a tool the client executes. The harness will send a
crate::protocol::ToolCall and wait for a
crate::protocol::ToolResponse.
Sourcepub fn harness_side_tools(self, tools: HarnessSideTools) -> Self
pub fn harness_side_tools(self, tools: HarnessSideTools) -> Self
Replaces the set of tools that run inside the harness itself.
Defaults to HarnessSideTools::read_only. Use
HarnessSideTools::all to add shell execution and file writes, or
HarnessSideTools::none for an agent that only talks.
Sourcepub fn mcp_server(self, server: McpServerConfig) -> Self
pub fn mcp_server(self, server: McpServerConfig) -> Self
Registers an MCP server for the harness to connect to.
Sourcepub fn hook(self, hook: LifecycleHook) -> Self
pub fn hook(self, hook: LifecycleHook) -> Self
Subscribes to a lifecycle hook. The harness will block the turn on a
crate::protocol::CallHookRequest until the client answers.
Sourcepub fn subagent(self, agent: CustomAgent) -> Self
pub fn subagent(self, agent: CustomAgent) -> Self
Registers a named subagent the model can delegate to.
Sourcepub fn policy(self, policy: PolicyConfig) -> Self
pub fn policy(self, policy: PolicyConfig) -> Self
Installs tool-permission rules evaluated inside the harness.
Sourcepub fn skills_path(self, path: impl AsRef<Path>) -> Self
pub fn skills_path(self, path: impl AsRef<Path>) -> Self
Adds a directory of agent skills.
Sourcepub fn app_data_dir(self, path: impl AsRef<Path>) -> Self
pub fn app_data_dir(self, path: impl AsRef<Path>) -> Self
Where generated artifacts and media are written.
Sourcepub fn env(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn env(self, key: impl Into<String>, value: impl Into<String>) -> Self
Sets an environment variable for the harness process.
Sourcepub fn harness_config(self, config: HarnessConfig) -> Self
pub fn harness_config(self, config: HarnessConfig) -> Self
Replaces the whole HarnessConfig, for settings this builder does not
surface.
Anything set by earlier builder calls is discarded — including the
default read-only tool set, so set
HarnessConfig::harness_side_tools yourself if you want any.
Sourcepub fn config(&self) -> &HarnessConfig
pub fn config(&self) -> &HarnessConfig
The HarnessConfig as built so far.
Trait Implementations§
Source§impl Clone for HarnessOptions
impl Clone for HarnessOptions
Source§fn clone(&self) -> HarnessOptions
fn clone(&self) -> HarnessOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more