pub trait OneShotClient: Send + Sync {
// Required method
fn submit<'life0, 'async_trait>(
&'life0 self,
request: OneShotRequest,
) -> Pin<Box<dyn Future<Output = Result<OneShotSubmission, OneShotError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn force_shutdown(&self) { ... }
fn submit_cancellable<'life0, 'async_trait>(
&'life0 self,
request: OneShotRequest,
cancellation: CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<OneShotSubmission, OneShotError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Provider-neutral boundary for isolated structured agent prompts.
Implementations own transport selection, protocol repair, temporary app-server lifecycle, and usage aggregation so callers submit one request without selecting a CLI or app-server execution helper.
Required Methods§
Sourcefn submit<'life0, 'async_trait>(
&'life0 self,
request: OneShotRequest,
) -> Pin<Box<dyn Future<Output = Result<OneShotSubmission, OneShotError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn submit<'life0, 'async_trait>(
&'life0 self,
request: OneShotRequest,
) -> Pin<Box<dyn Future<Output = Result<OneShotSubmission, OneShotError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Executes one isolated prompt and returns its parsed response and usage.
Dropping this future must initiate cleanup of owned provider resources.
Use submit_cancellable to wait for asynchronous cleanup on
cancellation. Implementations must enforce provider_call_budget
for every underlying provider attempt, including protocol repairs
and transport retries.
Provided Methods§
Sourcefn force_shutdown(&self)
fn force_shutdown(&self)
Escalates application shutdown after its graceful deadline. This must return immediately and permanently stop detached submission tasks. The owner also drops in-flight submission futures; adapters whose resources are owned entirely by those futures need no extra action.
Sourcefn submit_cancellable<'life0, 'async_trait>(
&'life0 self,
request: OneShotRequest,
cancellation: CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<OneShotSubmission, OneShotError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn submit_cancellable<'life0, 'async_trait>(
&'life0 self,
request: OneShotRequest,
cancellation: CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<OneShotSubmission, OneShotError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Cancels an isolated prompt and waits for adapter cleanup before
returning. The default drops submit, suitable for transports with
synchronous drop cleanup. Adapters requiring asynchronous shutdown
must override this method.
Sourcefn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Releases retained provider resources after all submissions and their asynchronous cancellation cleanup have finished. Stateless adapters need no cleanup.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".