pub struct ProtocolServer { /* private fields */ }Implementations§
Source§impl ProtocolServer
impl ProtocolServer
pub fn new(runtime: AgentRuntime) -> Self
pub fn from_builder(builder: AgentBuilder) -> Result<Self, AgentError>
Sourcepub async fn register_tool(
&self,
name: String,
_description: String,
_parameters: Value,
)
pub async fn register_tool( &self, name: String, _description: String, _parameters: Value, )
Register a Python-side tool.
Sourcepub async fn prepare_tool_call(
&self,
) -> UnboundedSender<AgentResult<ToolOutput>>
pub async fn prepare_tool_call( &self, ) -> UnboundedSender<AgentResult<ToolOutput>>
Set up the response channel for the NEXT tool call. Returns the sender — keep it; send the result when the SDK replies.
pub async fn create_session( &self, external_id: Option<String>, ) -> (SessionId, Option<String>)
Sourcepub async fn get_or_create_session(
&self,
external_id: Option<String>,
) -> SessionId
pub async fn get_or_create_session( &self, external_id: Option<String>, ) -> SessionId
Get or create a session by external_id.
If external_id is Some and a session with that id already
exists, it is reused (preserving conversation history). Otherwise
a new session is created and registered.
pub fn subscribe_events(&self) -> Receiver<RuntimeEvent>
pub async fn run_turn<F>( &self, sid: &SessionId, input: &str, f: F, ) -> AgentResult<RunOutcome>
pub fn cancel(&self)
Sourcepub async fn list_tools(&self) -> Vec<ToolMetadata>
pub async fn list_tools(&self) -> Vec<ToolMetadata>
List all registered tools with their metadata, sorted by name.
Trait Implementations§
Source§impl Clone for ProtocolServer
impl Clone for ProtocolServer
Source§fn clone(&self) -> ProtocolServer
fn clone(&self) -> ProtocolServer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for ProtocolServer
impl !UnwindSafe for ProtocolServer
impl Freeze for ProtocolServer
impl Send for ProtocolServer
impl Sync for ProtocolServer
impl Unpin for ProtocolServer
impl UnsafeUnpin for ProtocolServer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more