Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.ai-stats.phaseo.app/llms.txt

Use this file to discover all available pages before exploring further.

Use this recipe when a Go service needs to answer operational questions with local context.

1. Install the SDKs

go get github.com/AI-Stats/AI-Stats/packages/sdk/sdk-go@latest
go get github.com/AI-Stats/AI-Stats/packages/sdk/agent-sdk-go@latest

2. Define small runtime tools

statusTool := aistatsagent.DefineTool(aistatsagent.Tool{
  ID:          "read-status",
  Description: "Read the current service status page summary.",
  Execute: func(input any, ctx aistatsagent.RuntimeContext) (any, error) {
    return map[string]any{
      "status": "degraded",
      "summary": "Latency is elevated on one provider route.",
    }, nil
  },
})

3. Create the agent

agent := aistatsagent.CreateAgent(aistatsagent.AgentDefinition{
  ID:           "ops-runbook-agent",
  Model:        "openai/gpt-5.4-nano",
  Instructions: "Use tools when helpful and answer briefly.",
  Tools:        []aistatsagent.Tool{statusTool},
})

4. Run one bounded troubleshooting turn

client, _ := aistatsagent.CreateGatewayAgentClient(aistatsagent.GatewayAgentClientOptions{})

result, err := agent.Run(context.Background(), aistatsagent.RunOptions{
  Input:  "What is happening with provider latency right now?",
  Client: client,
})
if err != nil {
  panic(err)
}

fmt.Println(result.Output)

When this recipe fits

  • the workflow belongs inside one Go service
  • the supporting context already exists as local or internal calls
  • you want an agent loop without introducing a larger job system yet
Last modified on May 19, 2026