pub struct PythonRuntime { /* private fields */ }Expand description
Manages a dedicated Python thread with an asyncio event loop.
All Python/SDK interactions go through the command channel. This isolates GIL acquisition to the Python thread and keeps the tokio runtime responsive.
Implementations§
Source§impl PythonRuntime
impl PythonRuntime
Trait Implementations§
Source§impl Debug for PythonRuntime
impl Debug for PythonRuntime
Source§impl Drop for PythonRuntime
impl Drop for PythonRuntime
Source§impl Runtime for PythonRuntime
impl Runtime for PythonRuntime
Source§async fn create_agent(
&self,
agent_id: u64,
config: AgentConfig,
) -> Result<(AgentId, Vec<AvailableTool>), Error>
async fn create_agent( &self, agent_id: u64, config: AgentConfig, ) -> Result<(AgentId, Vec<AvailableTool>), Error>
Create an agent from the given config, returning its ID and the list
of all available tools (custom, MCP, and builtin) with metadata. Read more
Source§async fn chat(
&self,
agent_id: AgentId,
content: &Content,
) -> Result<ChatResponseHandle, Error>
async fn chat( &self, agent_id: AgentId, content: &Content, ) -> Result<ChatResponseHandle, Error>
Send a chat message to the agent, returning a streaming response handle. Read more
Source§async fn shutdown_agent(&self, agent_id: AgentId) -> Result<(), Error>
async fn shutdown_agent(&self, agent_id: AgentId) -> Result<(), Error>
Gracefully shut down the agent.
Source§fn try_shutdown_agent(&self, agent_id: AgentId)
fn try_shutdown_agent(&self, agent_id: AgentId)
Source§async fn cancel(&self, agent_id: AgentId) -> Result<(), Error>
async fn cancel(&self, agent_id: AgentId) -> Result<(), Error>
Interrupt any active prompt/chat run.
Source§async fn wait_for_idle(&self, agent_id: AgentId) -> Result<(), Error>
async fn wait_for_idle(&self, agent_id: AgentId) -> Result<(), Error>
Wait for the active run or conversational loop to stabilize.
Source§async fn send(&self, agent_id: AgentId, content: &Content) -> Result<(), Error>
async fn send(&self, agent_id: AgentId, content: &Content) -> Result<(), Error>
Send a message without waiting for completion.
Source§async fn signal_idle(&self, agent_id: AgentId) -> Result<(), Error>
async fn signal_idle(&self, agent_id: AgentId) -> Result<(), Error>
Signal that the agent is idle.
Source§async fn wait_for_wakeup(
&self,
agent_id: AgentId,
timeout: Duration,
) -> Result<bool, Error>
async fn wait_for_wakeup( &self, agent_id: AgentId, timeout: Duration, ) -> Result<bool, Error>
Wait for the agent to wake up. Returns true if woken, false if timed out.
Source§async fn history(
&self,
agent_id: AgentId,
) -> Result<Vec<ConversationMessage>, Error>
async fn history( &self, agent_id: AgentId, ) -> Result<Vec<ConversationMessage>, Error>
Retrieve the conversation’s message history.
Source§async fn turn_count(&self, agent_id: AgentId) -> Result<u32, Error>
async fn turn_count(&self, agent_id: AgentId) -> Result<u32, Error>
Return the number of completed turns in the conversation.
Source§async fn total_usage(&self, agent_id: AgentId) -> Result<UsageMetadata, Error>
async fn total_usage(&self, agent_id: AgentId) -> Result<UsageMetadata, Error>
Return cumulative token usage across all turns.
Source§async fn last_turn_usage(
&self,
agent_id: AgentId,
) -> Result<UsageMetadata, Error>
async fn last_turn_usage( &self, agent_id: AgentId, ) -> Result<UsageMetadata, Error>
Return token usage from the most recent turn only.
Source§async fn clear_history(&self, agent_id: AgentId) -> Result<(), Error>
async fn clear_history(&self, agent_id: AgentId) -> Result<(), Error>
Clear the conversation history and reset state.
Source§async fn remove_last_turn(&self, agent_id: AgentId) -> Result<(), Error>
async fn remove_last_turn(&self, agent_id: AgentId) -> Result<(), Error>
Remove the last user+model turn pair from conversation history. Read more
Source§async fn compaction_indices(&self, agent_id: AgentId) -> Result<Vec<u32>, Error>
async fn compaction_indices(&self, agent_id: AgentId) -> Result<Vec<u32>, Error>
Return the step indices at which compaction occurred. Read more
Source§async fn last_response(
&self,
agent_id: AgentId,
) -> Result<Option<String>, Error>
async fn last_response( &self, agent_id: AgentId, ) -> Result<Option<String>, Error>
Return the text of the last model response, if any. Read more
Source§async fn delete(&self, agent_id: AgentId) -> Result<(), Error>
async fn delete(&self, agent_id: AgentId) -> Result<(), Error>
Delete the conversation and all associated state. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for PythonRuntime
impl !UnwindSafe for PythonRuntime
impl Freeze for PythonRuntime
impl Send for PythonRuntime
impl Sync for PythonRuntime
impl Unpin for PythonRuntime
impl UnsafeUnpin for PythonRuntime
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