1use noxy_sdk::{init_noxy_agent_client, NoxyConfig, NoxyHumanDecisionOutcome};
7const NOXY_ENDPOINT: &str = "https://relay.noxy.network";
8
9#[tokio::main]
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}