Go SDK

Go SDK

Send decision requests from your Go agent system

Download

Installation


  go get github.com/noxy-network/go-sdk@v2.0.1
  
Code

Quick Start


  package main

  import (
    "context"
    "fmt"
  
    noxy "github.com/noxy-network/"
  )
  
  func main() {
    ctx := context.Background()
    client, err := noxy.InitNoxyAgentClient(ctx, noxy.NoxyConfig{
      Endpoint:           "https://relay.noxy.network",
      AuthToken:          "your-api-token",
      DecisionTTLSeconds: 3600,
    })
    if err != nil {
      panic(err)
    }
    defer client.Close()
  
    resolution, err := client.SendDecisionAndWaitForOutcome(ctx,
      "0x...",
      map[string]interface{}{
        "kind":    "propose_tool_call",
        "tool":    "transfer_funds",
        "args":    map[string]interface{}{"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.",
      },
      nil,
    )
    if err != nil {
      panic(err)
    }
  
    if resolution.Outcome == noxy.NoxyHumanDecisionOutcomeApproved {
      // your agent should run the proposed action
    } else {
      // your agent should abort the proposed action
    }
  }