Skip to main content

HarnessOptions

Struct HarnessOptions 

Source
pub struct HarnessOptions { /* private fields */ }
Available on crate feature 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

Source

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.

Source

pub fn binary(self, path: impl Into<PathBuf>) -> Self

Overrides binary discovery with an explicit path.

Source

pub fn storage_directory(self, path: impl Into<PathBuf>) -> Self

Where the harness persists conversation state between runs.

Leave unset for an ephemeral session.

Source

pub fn workspace(self, directory: impl AsRef<Path>) -> Self

Adds a directory the agent is allowed to read and write.

Source

pub fn model(self, model: ModelBuilder) -> Self

Adds a model. Call more than once to register several.

Source

pub fn system_instructions(self, instructions: SystemInstructions) -> Self

Sets the system prompt, replacing the harness’s built-in identity.

Source

pub fn cascade_id(self, id: impl Into<String>) -> Self

Resumes, or creates, a conversation by id.

Source

pub fn continuation_mode( self, mode: HarnessConfigSessionContinuationMode, ) -> Self

Chooses how an existing cascade_id is treated.

Source

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.

Source

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.

Source

pub fn mcp_server(self, server: McpServerConfig) -> Self

Registers an MCP server for the harness to connect to.

Source

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.

Source

pub fn subagent(self, agent: CustomAgent) -> Self

Registers a named subagent the model can delegate to.

Source

pub fn policy(self, policy: PolicyConfig) -> Self

Installs tool-permission rules evaluated inside the harness.

Source

pub fn skills_path(self, path: impl AsRef<Path>) -> Self

Adds a directory of agent skills.

Source

pub fn app_data_dir(self, path: impl AsRef<Path>) -> Self

Where generated artifacts and media are written.

Source

pub fn env(self, key: impl Into<String>, value: impl Into<String>) -> Self

Sets an environment variable for the harness process.

Source

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.

Source

pub fn config(&self) -> &HarnessConfig

The HarnessConfig as built so far.

Trait Implementations§

Source§

impl Clone for HarnessOptions

Source§

fn clone(&self) -> HarnessOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HarnessOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for HarnessOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V