pub struct AgentDialer { /* private fields */ }Expand description
Reusable handle for dialing the polychrome control plane.
Implementations§
Source§impl AgentDialer
impl AgentDialer
Sourcepub fn new(addr: &str) -> Result<Self, DialError>
pub fn new(addr: &str) -> Result<Self, DialError>
Build a dialer pointed at addr (expects http://host:port).
§Errors
Returns DialError::InvalidAddress if addr isn’t a valid URI.
Sourcepub fn approval_dialer(addr: &str) -> Result<ApprovalDialer, DialError>
pub fn approval_dialer(addr: &str) -> Result<ApprovalDialer, DialError>
Build an ApprovalDialer for the SAME control-plane endpoint.
AgentService and ApprovalService are served on one Connect port, so
an approval client reuses the agent address — callers that already hold
an AgentDialer don’t need to thread a second address.
§Errors
Returns DialError::InvalidAddress if addr isn’t a valid URI.
Sourcepub async fn run_turn(
&self,
conversation_id: &str,
exec_id: &str,
user_text: &str,
) -> Result<String, DialError>
pub async fn run_turn( &self, conversation_id: &str, exec_id: &str, user_text: &str, ) -> Result<String, DialError>
Run one turn against the control plane and collect the aggregated text response.
conversation_id is the stable id for the conversation (the Slack
adapter derives it from the thread; the CLI takes it as an argument).
user_text is the user message with any bot mention already stripped.
Returns the concatenated assistant text across every batch in the
response stream, or Ok(String::new()) if the turn produced no text.
Non-text content variants (tool calls, tool results, thoughts) are
rendered as bracketed placeholders.
§Errors
Returns DialError::Connect for any transport/stream/encoding
error from the AgentService call.
Sourcepub async fn run_turn_with(
&self,
conversation_id: &str,
exec_id: &str,
user_text: &str,
attribution: Attribution,
) -> Result<String, DialError>
pub async fn run_turn_with( &self, conversation_id: &str, exec_id: &str, user_text: &str, attribution: Attribution, ) -> Result<String, DialError>
Like run_turn but attributes the turn to a caller
(and participants). Non-streaming edges that resolve an identity via
EdgeAdapter::caller use this so their turns populate
AgentStart.caller (persona attribution) — the buffered analog of
run_turn_streaming_messages_with.
§Errors
Returns DialError::Connect for any transport/stream/encoding error.
Sourcepub async fn run_turn_streaming(
&self,
conversation_id: &str,
exec_id: &str,
user_text: &str,
) -> Result<impl Stream<Item = Result<TurnEvent, DialError>>, DialError>
pub async fn run_turn_streaming( &self, conversation_id: &str, exec_id: &str, user_text: &str, ) -> Result<impl Stream<Item = Result<TurnEvent, DialError>>, DialError>
Run one turn against the control plane and stream each meaningful step
as a TurnEvent, for live surfaces that update in place.
The request is built identically to AgentDialer::run_turn; see that
method for the meaning of conversation_id, exec_id, and
user_text. The returned stream yields:
TurnEvent::TextDeltafor each model/assistant-role text block,TurnEvent::ToolStartedwhen a tool call begins, andTurnEvent::Doneonce at end-of-turn, after which the stream ends.
Tool-role result echoes and empty/non-textual blocks produce no event.
§Errors
The outer Result carries a DialError::Connect if opening the
stream fails. Each item is a Result so per-message transport/decode
errors surface inline without tearing down the whole stream type.
Sourcepub async fn run_turn_streaming_messages(
&self,
conversation_id: &str,
exec_id: &str,
messages: Vec<Message>,
) -> Result<impl Stream<Item = Result<TurnEvent, DialError>>, DialError>
pub async fn run_turn_streaming_messages( &self, conversation_id: &str, exec_id: &str, messages: Vec<Message>, ) -> Result<impl Stream<Item = Result<TurnEvent, DialError>>, DialError>
Like Self::run_turn_streaming but takes a pre-built (e.g. attributed
multi-party) message list as the turn input.
§Errors
Returns DialError::Connect for any transport/stream/encoding error.
Sourcepub async fn run_turn_streaming_messages_with(
&self,
conversation_id: &str,
exec_id: &str,
messages: Vec<Message>,
payment_receipt: Option<PaymentReceipt>,
attribution: Attribution,
) -> Result<impl Stream<Item = Result<TurnEvent, DialError>>, DialError>
pub async fn run_turn_streaming_messages_with( &self, conversation_id: &str, exec_id: &str, messages: Vec<Message>, payment_receipt: Option<PaymentReceipt>, attribution: Attribution, ) -> Result<impl Stream<Item = Result<TurnEvent, DialError>>, DialError>
The full-fidelity variant: one method carries everything a turn’s
request can — a settled inbound PaymentReceipt (the control plane
persists a signed payment_receipt event in the turn’s atomic batch)
and the caller Attribution (resolved to durable personas and
recorded as caller/participant events). One method rather than a
matrix of variants, so a paid and attributed edge can’t silently
drop one of the two.
§Errors
Returns DialError::Connect for any transport/stream/encoding error.
Sourcepub async fn should_respond(
&self,
conversation_id: &str,
bot_name: &str,
transcript: Vec<ParticipantMessage>,
) -> Result<bool, DialError>
pub async fn should_respond( &self, conversation_id: &str, bot_name: &str, transcript: Vec<ParticipantMessage>, ) -> Result<bool, DialError>
Ask the control plane’s participation gate whether to reply to the
latest message of a (multi-party) thread. Returns true only on
respond; notify / ignore map to false (stay silent). The gate
runs a cheap classifier model server-side and never runs a turn.
§Errors
Returns DialError::Connect for any transport/encoding error.
Trait Implementations§
Source§impl Clone for AgentDialer
impl Clone for AgentDialer
Source§fn clone(&self) -> AgentDialer
fn clone(&self) -> AgentDialer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for AgentDialer
impl !UnwindSafe for AgentDialer
impl Freeze for AgentDialer
impl Send for AgentDialer
impl Sync for AgentDialer
impl Unpin for AgentDialer
impl UnsafeUnpin for AgentDialer
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request