pub struct NoxyAgentClient { /* private fields */ }Implementations§
Source§impl NoxyAgentClient
impl NoxyAgentClient
Sourcepub async fn send_decision<T>(
&self,
identity_address: NoxyIdentityAddress,
actionable_decision: &T,
) -> Result<Vec<NoxyDeliveryOutcome>, Box<dyn Error + Send + Sync>>where
T: Serialize,
pub async fn send_decision<T>(
&self,
identity_address: NoxyIdentityAddress,
actionable_decision: &T,
) -> Result<Vec<NoxyDeliveryOutcome>, Box<dyn Error + Send + Sync>>where
T: Serialize,
Route an actionable decision to all devices registered for the identity.
Uses one client-generated decision_id (UUID) for the whole batch so every device shares the same logical decision.
Sourcepub async fn get_decision_outcome(
&self,
decision_id: &str,
identity_id: &str,
) -> Result<NoxyGetDecisionOutcomeResponse, Status>
pub async fn get_decision_outcome( &self, decision_id: &str, identity_id: &str, ) -> Result<NoxyGetDecisionOutcomeResponse, Status>
Single poll for human-in-the-loop resolution.
Sourcepub async fn wait_for_decision_outcome(
&self,
options: WaitForDecisionOutcomeOptions,
) -> Result<NoxyGetDecisionOutcomeResponse, Box<dyn Error + Send + Sync>>
pub async fn wait_for_decision_outcome( &self, options: WaitForDecisionOutcomeOptions, ) -> Result<NoxyGetDecisionOutcomeResponse, Box<dyn Error + Send + Sync>>
Poll GetDecisionOutcome with exponential backoff until terminal outcome or pending == false.
Sourcepub async fn send_decision_and_wait_for_outcome<T>(
&self,
identity_address: NoxyIdentityAddress,
actionable_decision: &T,
options: Option<SendDecisionAndWaitOptions>,
) -> Result<NoxyGetDecisionOutcomeResponse, Box<dyn Error + Send + Sync>>where
T: Serialize,
pub async fn send_decision_and_wait_for_outcome<T>(
&self,
identity_address: NoxyIdentityAddress,
actionable_decision: &T,
options: Option<SendDecisionAndWaitOptions>,
) -> Result<NoxyGetDecisionOutcomeResponse, Box<dyn Error + Send + Sync>>where
T: Serialize,
[send_decision] then [wait_for_decision_outcome] using the first delivery with a non-empty decision_id.
Examples found in repository?
examples/basic.rs (line 38)
10async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
11 let auth_token = std::env::var("NOXY_APP_TOKEN").expect("NOXY_APP_TOKEN must be set");
12 let target_address = std::env::var("NOXY_TARGET_ADDRESS").expect("NOXY_TARGET_ADDRESS must be set");
13
14 let config = NoxyConfig {
15 endpoint: NOXY_ENDPOINT.to_string(),
16 auth_token,
17 decision_ttl_seconds: 3600,
18 };
19
20 let client = init_noxy_agent_client(config).await?;
21
22 let quota = client.get_quota().await?;
23 println!(
24 "Quota: {} / {} remaining (status: {:?})",
25 quota.quota_remaining, quota.quota_total, quota.status
26 );
27
28 let actionable = serde_json::json!({
29 "kind": "propose_tool_call",
30 "tool": "transfer_funds",
31 "args": { "to": "0x000000000000000000000000000000000000dEaD", "amountWei": "1" },
32 "title": "[RUST] Transfer 1 wei to the burn address",
33 "summary": "[RUST] The agent is requesting approval to send 1 wei to the burn address.",
34 });
35
36 println!("Routing decision to {}...", target_address);
37 let resolution = client
38 .send_decision_and_wait_for_outcome(target_address, &actionable, None)
39 .await?;
40
41 println!(
42 "Outcome: {:?}, pending: {}",
43 resolution.outcome, resolution.pending
44 );
45 if resolution.outcome == NoxyHumanDecisionOutcome::Approved {
46 println!("User approved — continue agent loop.");
47 }
48
49 Ok(())
50}Sourcepub async fn get_quota(&self) -> Result<NoxyGetQuotaResponse, Status>
pub async fn get_quota(&self) -> Result<NoxyGetQuotaResponse, Status>
Examples found in repository?
examples/basic.rs (line 22)
10async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
11 let auth_token = std::env::var("NOXY_APP_TOKEN").expect("NOXY_APP_TOKEN must be set");
12 let target_address = std::env::var("NOXY_TARGET_ADDRESS").expect("NOXY_TARGET_ADDRESS must be set");
13
14 let config = NoxyConfig {
15 endpoint: NOXY_ENDPOINT.to_string(),
16 auth_token,
17 decision_ttl_seconds: 3600,
18 };
19
20 let client = init_noxy_agent_client(config).await?;
21
22 let quota = client.get_quota().await?;
23 println!(
24 "Quota: {} / {} remaining (status: {:?})",
25 quota.quota_remaining, quota.quota_total, quota.status
26 );
27
28 let actionable = serde_json::json!({
29 "kind": "propose_tool_call",
30 "tool": "transfer_funds",
31 "args": { "to": "0x000000000000000000000000000000000000dEaD", "amountWei": "1" },
32 "title": "[RUST] Transfer 1 wei to the burn address",
33 "summary": "[RUST] The agent is requesting approval to send 1 wei to the burn address.",
34 });
35
36 println!("Routing decision to {}...", target_address);
37 let resolution = client
38 .send_decision_and_wait_for_outcome(target_address, &actionable, None)
39 .await?;
40
41 println!(
42 "Outcome: {:?}, pending: {}",
43 resolution.outcome, resolution.pending
44 );
45 if resolution.outcome == NoxyHumanDecisionOutcome::Approved {
46 println!("User approved — continue agent loop.");
47 }
48
49 Ok(())
50}Auto Trait Implementations§
impl !Freeze for NoxyAgentClient
impl !RefUnwindSafe for NoxyAgentClient
impl Send for NoxyAgentClient
impl Sync for NoxyAgentClient
impl Unpin for NoxyAgentClient
impl UnsafeUnpin for NoxyAgentClient
impl !UnwindSafe for NoxyAgentClient
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
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>
Wrap the input message
T in a tonic::Request