Rust SDK

Rust SDK

Send decision requests from your Rust agent system

Download

Installation


  cargo install --version 2.0.1 noxy-sdk
  
Code

Quick Start


  use noxy_sdk::{init_noxy_agent_client, NoxyConfig, NoxyHumanDecisionOutcome};

  #[tokio::main]
  async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
      let client = init_noxy_agent_client(NoxyConfig {
          endpoint: "https://relay.noxy.network".into(),
          auth_token: "your-api-token".into(),
          decision_ttl_seconds: 3600,
      })
      .await?;

      let identity = "0x...".to_string();
      let resolution = client
          .send_decision_and_wait_for_outcome(
              identity,
              &serde_json::json!({
                  "kind": "propose_tool_call",
                  "tool": "transfer_funds",
                  "args": { "to": "__your-burn-address__", "amountWei": "1" },
                  "title": "Transfer 1 wei to the burn address",
                  "summary": "The agent is requesting approval to send 1 wei to the burn address.",
              }),
              None,
          )
          .await?;

      if resolution.outcome == NoxyHumanDecisionOutcome::Approved {
          // your agent should run the proposed action
      }
      else {
        // your agent should abort the proposed action
      }
      Ok(())
  }