pub trait ProtocolAdapter: Send + Sync {
// Required methods
fn discover<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<RemoteCapabilities, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn invoke<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 str,
task: TaskRequest,
) -> Pin<Box<dyn Future<Output = Result<TaskHandle, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn stream<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 str,
task: TaskRequest,
) -> Pin<Box<dyn Future<Output = Result<TaskStream, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn status<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
url: &'life1 str,
task_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<TaskStatus, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn cancel<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
url: &'life1 str,
task_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
// Provided methods
fn stream_structured<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 str,
task: TaskRequest,
) -> Pin<Box<dyn Future<Output = Result<StructuredStream, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn stream_with_backpressure<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 str,
task: TaskRequest,
buffer_size: usize,
) -> Pin<Box<dyn Future<Output = Result<StructuredStream, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
The protocol adapter trait. Implement this to add a new agent communication protocol.
Required Methods§
Sourcefn discover<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<RemoteCapabilities, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn discover<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<RemoteCapabilities, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Discover remote capabilities (fetch Agent Card or equivalent).
Sourcefn invoke<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 str,
task: TaskRequest,
) -> Pin<Box<dyn Future<Output = Result<TaskHandle, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn invoke<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 str,
task: TaskRequest,
) -> Pin<Box<dyn Future<Output = Result<TaskHandle, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Submit a task/request to the remote.
Sourcefn stream<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 str,
task: TaskRequest,
) -> Pin<Box<dyn Future<Output = Result<TaskStream, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn stream<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 str,
task: TaskRequest,
) -> Pin<Box<dyn Future<Output = Result<TaskStream, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stream task progress events (for streaming tasks).
Sourcefn status<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
url: &'life1 str,
task_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<TaskStatus, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn status<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
url: &'life1 str,
task_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<TaskStatus, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Poll task status by task_id.
Provided Methods§
Sourcefn stream_structured<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 str,
task: TaskRequest,
) -> Pin<Box<dyn Future<Output = Result<StructuredStream, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn stream_structured<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 str,
task: TaskRequest,
) -> Pin<Box<dyn Future<Output = Result<StructuredStream, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stream task with structured typed chunks (I2.6).
Default: wraps stream() and maps TaskEvent to StreamChunk.
Each chunk is also emitted as a tracing span event (I2.8).
Sourcefn stream_with_backpressure<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 str,
task: TaskRequest,
buffer_size: usize,
) -> Pin<Box<dyn Future<Output = Result<StructuredStream, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn stream_with_backpressure<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 str,
task: TaskRequest,
buffer_size: usize,
) -> Pin<Box<dyn Future<Output = Result<StructuredStream, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stream with backpressure: bounded channel buffers at most buffer_size chunks
before applying flow control to the producer (I2.9).