agentsdk

package module
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2026 License: MIT Imports: 18 Imported by: 0

README

Agent SDK Go

Build and orchestrate AI agents in Go with a maintained multi-provider runtime and a typed model registry.

Code Quality Model Registry Refresh registry.json last update PkgGoDev

Why Use This Repository

This project is useful in two common scenarios:

  1. You need a Go SDK to run AI agents with tools, handoffs, streaming, and tracing.
  2. You need a reliable model catalog (provider, capabilities, pricing, metadata) that your app or AI agent can query directly.

If you only need catalog data, you can use pkg/model without adopting the full agent runtime.

Start in 2 Minutes

go get github.com/agentizen/agent-sdk-go
package main

import (
	"fmt"

	"github.com/agentizen/agent-sdk-go/pkg/model"
)

func main() {
	spec, ok := model.GetModelSpec("openai", "gpt-5.4")
	if !ok {
		panic("model not found")
	}

	fmt.Println(spec.Provider, spec.ModelID)
	fmt.Println(spec.Metadata.DisplayName)
	fmt.Println(spec.Pricing.InputCostPerMillion, spec.Pricing.OutputCostPerMillion)
	fmt.Println(spec.Capabilities.Vision, spec.Capabilities.Documents)
}

Model Registry API (Core Types)

Typed structures:

Core queries:

Agent Runtime (Core Packages)

  • pkg/agent: agent definition
  • pkg/runner: execution loop and streaming
  • pkg/tool: function tools and schema
  • pkg/model/providers/*: provider clients (OpenAI, Anthropic, Gemini, Mistral, LM Studio, Azure OpenAI)

Agent Networks

pkg/network lets multiple agents collaborate on a single user prompt. Configure a roster of specialised agents, choose a dispatch strategy, and let the built-in orchestrator handle decomposition and synthesis.

cfg := network.NewNetworkConfig().
    WithAgents(
        network.AgentSlot{Agent: researcher, Role: "Research specialist"},
        network.AgentSlot{Agent: analyst,    Role: "Strategic analyst"},
        network.AgentSlot{Agent: writer,     Role: "Content writer"},
    ).
    WithStrategy(network.StrategyParallel)

nr := network.NewNetworkRunner(runner.NewRunner().WithDefaultProvider(provider))
result, err := nr.RunNetwork(ctx, cfg, opts)
fmt.Println(result.FinalOutput)

Three built-in strategies:

Strategy Use case
StrategyParallel Independent sub-tasks — maximum throughput
StrategySequential Pipeline where each stage depends on the previous one
StrategyCompetitive Fastest non-error response wins — minimum latency

Full guide: docs/agent_network.md

Model Registry Refresh Workflow

Single workflow: .github/workflows/model-capabilities-sync.yml

It can:

  1. Optionally refresh scripts/sources/model_registry.json using an LLM.
  2. Validate JSON against scripts/sources/model_registry.schema.json.
  3. Regenerate:
    1. pkg/model/capabilities.go
    2. pkg/model/pricing.go
    3. pkg/model/metadata.go
    4. pkg/model/provider.go
  4. Run tests and open one PR containing both source and generated updates.

Required for AI refresh mode:

  • Secret: MODEL_REGISTRY_AI_API_KEY
  • Optional variables: MODEL_REGISTRY_AI_BASE_URL, MODEL_REGISTRY_AI_MODEL

Default OpenAI-compatible values:

  • MODEL_REGISTRY_AI_BASE_URL: https://api.openai.com/v1
  • MODEL_REGISTRY_AI_MODEL: gpt-5 or gpt-5-mini

Copilot note:

  • Copilot Chat is not a direct API target for this workflow.
  • Use an OpenAI-compatible endpoint/token (OpenAI or equivalent gateway).

Examples and Detailed Guides

Single-agent examples:

Agent Network examples:

Project docs:

Development and Contribution

Quick setup:

git clone https://github.com/agentizen/agent-sdk-go.git
cd agent-sdk-go
./scripts/ci_setup.sh
./scripts/check_all.sh

Contributing guide:

License:

Documentation

Overview

Package agentsdk provides a Go SDK for building multi-agent AI applications.

It supports tool use, skills, MCP integrations, plugins, agent handoffs, streaming responses, multi-turn conversations, and integrations with multiple LLM providers (OpenAI, Anthropic, Gemini, Mistral, LM Studio, Azure OpenAI).

Quick Start

import (
    agentsdk "github.com/agentizen/agent-sdk-go"
    "github.com/agentizen/agent-sdk-go/pkg/model/providers/openai"
)

provider := openai.NewProvider(os.Getenv("OPENAI_API_KEY"))

a := agentsdk.NewAgent("Assistant")
a.SetModelProvider(provider)
a.WithModel("gpt-4o-mini")
a.SetSystemInstructions("You are a helpful assistant.")

r := agentsdk.NewRunner()
r.WithDefaultProvider(provider)

result, err := r.Run(context.Background(), a, &agentsdk.RunOptions{
    Input: "Hello!",
})

See the examples/ directory for complete working examples with each provider.

Index

Constants

View Source
const (
	// StreamEventTypeContent is emitted for each streaming text chunk.
	StreamEventTypeContent = model.StreamEventTypeContent

	// StreamEventTypeToolCall is emitted when the model invokes a tool.
	StreamEventTypeToolCall = model.StreamEventTypeToolCall

	// StreamEventTypeHandoff is emitted on agent-to-agent handoffs.
	StreamEventTypeHandoff = model.StreamEventTypeHandoff

	// StreamEventTypeDone is emitted when the model finishes generating.
	StreamEventTypeDone = model.StreamEventTypeDone

	// StreamEventTypeError is emitted when an unrecoverable error occurs
	// during streaming.
	StreamEventTypeError = model.StreamEventTypeError

	// StreamingEventTypeThinkingStart is emitted when enriched streaming enters
	// the thinking phase.
	StreamingEventTypeThinkingStart = streaming.EventThinkingStart

	// StreamingEventTypeThinkingChunk is emitted for each enriched thinking chunk.
	StreamingEventTypeThinkingChunk = streaming.EventThinkingChunk

	// StreamingEventTypeThinkingEnd is emitted when the thinking phase ends.
	StreamingEventTypeThinkingEnd = streaming.EventThinkingEnd

	// StreamingEventTypeContentStart is emitted when enriched streaming enters
	// the content phase.
	StreamingEventTypeContentStart = streaming.EventContentStart

	// StreamingEventTypeContentChunk is emitted for each enriched content chunk.
	StreamingEventTypeContentChunk = streaming.EventContentChunk

	// StreamingEventTypeContentEnd is emitted when the content phase ends.
	StreamingEventTypeContentEnd = streaming.EventContentEnd

	// StreamingEventTypeToolCall is emitted when an enriched stream records a
	// tool invocation.
	StreamingEventTypeToolCall = streaming.EventToolCall

	// StreamingEventTypeToolCallResult is emitted when the last tool call is
	// resolved.
	StreamingEventTypeToolCallResult = streaming.EventToolCallResult

	// StreamingEventTypeHandoff is emitted when an enriched stream forwards a
	// handoff event.
	StreamingEventTypeHandoff = streaming.EventHandoff

	// StreamingEventTypeDone is emitted when the enriched stream completes.
	StreamingEventTypeDone = streaming.EventDone

	// StreamingEventTypeError is emitted when the enriched stream encounters an
	// unrecoverable error.
	StreamingEventTypeError = streaming.EventError

	// StreamingEventTypeAgentStart is emitted when a sub-agent begins work in a
	// network stream.
	StreamingEventTypeAgentStart = streaming.EventAgentStart

	// StreamingEventTypeAgentEnd is emitted when a sub-agent finishes work in a
	// network stream.
	StreamingEventTypeAgentEnd = streaming.EventAgentEnd
)

Streaming event type constants — forwarded from the model and streaming packages.

View Source
const (
	// ValidationError is a blocking validation failure that halts the workflow.
	ValidationError = runner.ValidationError

	// StrategyParallel runs all agents concurrently.
	StrategyParallel = network.StrategyParallel

	// StrategySequential runs agents one after another.
	StrategySequential = network.StrategySequential

	// StrategyCompetitive sends the same prompt to all agents and keeps the first winner.
	StrategyCompetitive = network.StrategyCompetitive

	// EventSubAgentStart is emitted when a sub-agent starts work.
	EventSubAgentStart = network.EventSubAgentStart

	// EventSubAgentEnd is emitted when a sub-agent finishes work.
	EventSubAgentEnd = network.EventSubAgentEnd

	// EventOrchestratorContent is emitted for each orchestrator content chunk.
	EventOrchestratorContent = network.EventOrchestratorContent

	// EventOrchestratorDone is emitted when orchestrator synthesis completes.
	EventOrchestratorDone = network.EventOrchestratorDone

	// EventOrchestratorToolCall is emitted when the orchestrator invokes a tool.
	EventOrchestratorToolCall = network.EventOrchestratorToolCall

	// EventNetworkError is emitted on unrecoverable network execution errors.
	EventNetworkError = network.EventNetworkError

	// EventThinkingStart is emitted when enriched streaming enters the thinking phase.
	EventThinkingStart = streaming.EventThinkingStart

	// EventThinkingChunk is emitted for each thinking chunk.
	EventThinkingChunk = streaming.EventThinkingChunk

	// EventThinkingEnd is emitted when the thinking phase ends.
	EventThinkingEnd = streaming.EventThinkingEnd

	// EventContentStart is emitted when enriched streaming enters the content phase.
	EventContentStart = streaming.EventContentStart

	// EventContentChunk is emitted for each content chunk.
	EventContentChunk = streaming.EventContentChunk

	// EventContentEnd is emitted when the content phase ends.
	EventContentEnd = streaming.EventContentEnd

	// EventToolCall is emitted when an enriched stream records a tool call.
	EventToolCall = streaming.EventToolCall

	// EventToolCallResult is emitted when an enriched stream records a tool result.
	EventToolCallResult = streaming.EventToolCallResult

	// EventHandoff is emitted when an enriched stream forwards a handoff.
	EventHandoff = streaming.EventHandoff

	// EventDone is emitted when an enriched stream completes.
	EventDone = streaming.EventDone

	// EventError is emitted when an enriched stream encounters an error.
	EventError = streaming.EventError

	// EventAgentStart is emitted when a sub-agent starts in a network stream.
	EventAgentStart = streaming.EventAgentStart

	// EventAgentEnd is emitted when a sub-agent ends in a network stream.
	EventAgentEnd = streaming.EventAgentEnd

	// ValidationWarning is a non-blocking validation failure logged but not
	// halting.
	ValidationWarning = runner.ValidationWarning
)

Validation severity constants.

View Source
const (
	// ContentPartTypeText marks a plain-text segment.
	ContentPartTypeText = model.ContentPartTypeText

	// CapabilityAudioGeneration indicates audio generation support.
	CapabilityAudioGeneration = model.CapabilityAudioGeneration

	// CapabilityBatchAPI indicates batch API support.
	CapabilityBatchAPI = model.CapabilityBatchAPI

	// CapabilityCaching indicates input caching support.
	CapabilityCaching = model.CapabilityCaching

	// CapabilityCodeExecution indicates code execution support.
	CapabilityCodeExecution = model.CapabilityCodeExecution

	// CapabilityDocuments indicates native document support.
	CapabilityDocuments = model.CapabilityDocuments

	// CapabilityFileSearch indicates file search support.
	CapabilityFileSearch = model.CapabilityFileSearch

	// CapabilityFunctionCalling indicates function calling support.
	CapabilityFunctionCalling = model.CapabilityFunctionCalling

	// CapabilityImageGeneration indicates image generation support.
	CapabilityImageGeneration = model.CapabilityImageGeneration

	// CapabilityLiveAPI indicates live API support.
	CapabilityLiveAPI = model.CapabilityLiveAPI

	// CapabilityStructuredOutput indicates structured output support.
	CapabilityStructuredOutput = model.CapabilityStructuredOutput

	// CapabilityThinking indicates reasoning/thinking support.
	CapabilityThinking = model.CapabilityThinking

	// CapabilityVision indicates vision support.
	CapabilityVision = model.CapabilityVision

	// ContentPartTypeDocument marks a document segment (PDF, plain-text file).
	ContentPartTypeDocument = model.ContentPartTypeDocument

	// ContentPartTypeImage marks an image segment (PNG, JPEG, GIF, WEBP).
	ContentPartTypeImage = model.ContentPartTypeImage
)

ContentPartType constants for multi-modal messages.

View Source
const (
	// HandoffTypeDelegate indicates the current agent is delegating a task to
	// another agent.
	HandoffTypeDelegate = model.HandoffTypeDelegate

	// EventTypeAgentStart is emitted when an agent run begins.
	EventTypeAgentStart = tracing.EventTypeAgentStart

	// EventTypeAgentEnd is emitted when an agent run completes.
	EventTypeAgentEnd = tracing.EventTypeAgentEnd

	// EventTypeToolCall is emitted when a tool is invoked.
	EventTypeToolCall = tracing.EventTypeToolCall

	// EventTypeToolResult is emitted when a tool result is returned.
	EventTypeToolResult = tracing.EventTypeToolResult

	// EventTypeModelRequest is emitted before a model request.
	EventTypeModelRequest = tracing.EventTypeModelRequest

	// EventTypeModelResponse is emitted after a model response.
	EventTypeModelResponse = tracing.EventTypeModelResponse

	// EventTypeHandoff is emitted for handoff activity.
	EventTypeHandoff = tracing.EventTypeHandoff

	// EventTypeHandoffComplete is emitted when a handoff finishes.
	EventTypeHandoffComplete = tracing.EventTypeHandoffComplete

	// EventTypeAgentMessage is emitted for agent-generated messages.
	EventTypeAgentMessage = tracing.EventTypeAgentMessage

	// EventTypeError is emitted when tracing records an error.
	EventTypeError = tracing.EventTypeError

	// EventTypeSkillLoad is emitted when a skill is loaded.
	EventTypeSkillLoad = tracing.EventTypeSkillLoad

	// EventTypeMCPCall is emitted for MCP calls.
	EventTypeMCPCall = tracing.EventTypeMCPCall

	// EventTypeMCPResult is emitted for MCP results.
	EventTypeMCPResult = tracing.EventTypeMCPResult

	// EventTypePluginInit is emitted when a plugin is initialized.
	EventTypePluginInit = tracing.EventTypePluginInit

	// OpenAIAPITypeOpenAI identifies the default OpenAI API mode.
	OpenAIAPITypeOpenAI = openaiprovider.APITypeOpenAI

	// OpenAIAPITypeAzure identifies Azure OpenAI key-based mode.
	OpenAIAPITypeAzure = openaiprovider.APITypeAzure

	// OpenAIAPITypeAzureAD identifies Azure OpenAI AAD mode.
	OpenAIAPITypeAzureAD = openaiprovider.APITypeAzureAD

	// HandoffTypeReturn indicates the current agent is returning a completed
	// task result to its delegator.
	HandoffTypeReturn = model.HandoffTypeReturn
)

Handoff type constants.

Variables

View Source
var Version = "dev"

Version is the SDK version. It is overridden at release time via:

-ldflags "-X github.com/agentizen/agent-sdk-go.Version=<tag>"

Functions

func ExtractThinkingText added in v0.11.4

func ExtractThinkingText(chunk string) (string, bool)

ExtractThinkingText extracts `<think>...</think>` text from a stream chunk, if present.

func HeadersFromContext added in v0.11.5

func HeadersFromContext(ctx context.Context) map[string]string

HeadersFromContext extracts MCP headers from a context.

func ProviderSupports added in v0.11.5

func ProviderSupports(provider, modelID string, cap Capability) bool

ProviderSupports reports whether a provider/model exposes a capability.

func RecordEvent added in v0.11.5

func RecordEvent(ctx context.Context, event Event)

RecordEvent records an event using the process-wide tracer.

func SetGlobalTracer added in v0.11.5

func SetGlobalTracer(tracer Tracer)

SetGlobalTracer sets the process-wide tracer.

func UserIDFromContext added in v0.11.5

func UserIDFromContext(ctx context.Context) string

UserIDFromContext extracts the MCP user ID from a context.

func WithHeaders added in v0.11.5

func WithHeaders(ctx context.Context, headers map[string]string) context.Context

WithHeaders attaches additional MCP headers to the context.

func WithToolDataBus added in v0.12.0

func WithToolDataBus(ctx context.Context, bus *ToolDataBus) context.Context

WithToolDataBus returns a new context carrying the given bus.

func WithUserID added in v0.11.5

func WithUserID(ctx context.Context, userID string) context.Context

WithUserID attaches a user ID to the context for MCP transports.

Types

type Agent

type Agent = agent.Agent

Agent is an AI agent with tools, skills, MCP servers, plugins, handoffs, and lifecycle hooks.

func NewAgent

func NewAgent(name ...string) *Agent

NewAgent creates a new Agent. An optional name and instructions can be provided as positional arguments: NewAgent("name", "instructions").

type AgentRunResult added in v0.11.5

type AgentRunResult = network.AgentRunResult

AgentRunResult is the result of one sub-agent run inside a network.

type AgentSlot added in v0.11.5

type AgentSlot = network.AgentSlot

AgentSlot binds an agent to a role in a multi-agent network.

type AnthropicProvider added in v0.11.5

type AnthropicProvider = anthropicprovider.Provider

AnthropicProvider is the public Anthropic provider type.

func NewAnthropicProvider added in v0.11.5

func NewAnthropicProvider(apiKey string) *AnthropicProvider

NewAnthropicProvider creates an Anthropic provider with default settings.

type BasePlugin

type BasePlugin = plugin.BasePlugin

BasePlugin provides a default embeddable implementation of Plugin.

type Capability added in v0.11.5

type Capability = model.Capability

Capability identifies one model capability such as vision or thinking.

type ContentPart

type ContentPart = model.ContentPart

ContentPart is one segment of a multi-modal message (text, image, or document).

type ContentPartType added in v0.11.5

type ContentPartType = model.ContentPartType

ContentPartType identifies the type of a multimodal content part.

type DefaultAgentHooks added in v0.12.0

type DefaultAgentHooks = agent.DefaultAgentHooks

DefaultAgentHooks provides a no-op embeddable implementation of Hooks.

type DispatchStrategy added in v0.11.5

type DispatchStrategy = network.DispatchStrategy

DispatchStrategy controls how sub-tasks are distributed in a network.

type Event added in v0.11.5

type Event = tracing.Event

Event is a trace event emitted by the SDK tracer.

type ExecutableTool

type ExecutableTool = tool.ExecutableTool

ExecutableTool runs an external process as a tool.

func NewExecutableTool

func NewExecutableTool(name, description, command string, args []string) *ExecutableTool

NewExecutableTool creates a tool that runs an external process (shell, python, node). Parameters are JSON-serialized to stdin; stdout is parsed as the result.

type FileTracer added in v0.11.5

type FileTracer = tracing.FileTracer

FileTracer writes trace events to a local file.

type FunctionTool

type FunctionTool = tool.FunctionTool

FunctionTool wraps a Go function as an agent tool.

func NewFunctionTool

func NewFunctionTool(name, description string, fn interface{}) *FunctionTool

NewFunctionTool creates a tool backed by an arbitrary Go function.

The function signature may be:

  • func(ctx context.Context, params map[string]interface{}) (interface{}, error)
  • func(params map[string]interface{}) (interface{}, error)
  • func(ctx context.Context, input MyStruct) (MyResult, error)

A JSON Schema is inferred automatically from the function signature. Use (*FunctionTool).WithSchema to override it.

type GeminiProvider added in v0.11.5

type GeminiProvider = geminiprovider.Provider

GeminiProvider is the public Gemini provider type.

func NewGeminiProvider added in v0.11.5

func NewGeminiProvider(apiKey string) *GeminiProvider

NewGeminiProvider creates a Gemini provider with default settings.

type HandoffCall

type HandoffCall = model.HandoffCall

HandoffCall describes the parameters of an agent-to-agent handoff or return-to-delegator event.

type HandoffInputFilter

type HandoffInputFilter = runner.HandoffInputFilter

HandoffInputFilter transforms the input payload before it is forwarded to the receiving agent during a handoff.

type Hooks added in v0.12.0

type Hooks = agent.Hooks

Hooks defines the lifecycle hook interface for an agent.

type InputGuardrail

type InputGuardrail = runner.InputGuardrail

InputGuardrail validates agent input before each model call.

type MCPClient

type MCPClient = mcp.Client

MCPClient is the transport interface for communicating with MCP servers.

type MCPClientOptions

type MCPClientOptions = mcp.ClientOptions

MCPClientOptions configures the HTTP MCP client transport.

type MCPHTTPClient

type MCPHTTPClient = mcp.HTTPClient

MCPHTTPClient is the default HTTP implementation of MCPClient.

func NewMCPHTTPClient

func NewMCPHTTPClient(opts MCPClientOptions) *MCPHTTPClient

NewMCPHTTPClient creates an HTTP client for communicating with MCP servers.

type MCPRegistry

type MCPRegistry = mcp.Registry

MCPRegistry manages MCP server configurations.

func NewMCPRegistry

func NewMCPRegistry() *MCPRegistry

NewMCPRegistry creates a new MCP server registry.

type MCPServerConfig

type MCPServerConfig = mcp.ServerConfig

MCPServerConfig describes an MCP server and its transport.

type MCPToolInfo

type MCPToolInfo = mcp.ToolInfo

MCPToolInfo describes a tool exposed by an MCP server.

type MistralProvider added in v0.11.5

type MistralProvider = mistralprovider.Provider

MistralProvider is the public Mistral provider type.

func NewMistralProvider added in v0.11.5

func NewMistralProvider(apiKey string) *MistralProvider

NewMistralProvider creates a Mistral provider with default settings.

type Model added in v0.11.5

type Model = model.Model

Model is the interface implemented by all LLM backends.

type ModelCapabilitySet added in v0.11.5

type ModelCapabilitySet = model.ModelCapabilitySet

ModelCapabilitySet is the resolved set of capabilities for a model.

func CapabilitiesFor added in v0.11.5

func CapabilitiesFor(provider, modelID string) ModelCapabilitySet

CapabilitiesFor returns the full capability set for a provider/model pair.

type ModelMetadata added in v0.11.5

type ModelMetadata = model.ModelMetadata

ModelMetadata contains descriptive metadata for a registered model.

func GetModelMetadata added in v0.11.5

func GetModelMetadata(provider, modelID string) (ModelMetadata, bool)

GetModelMetadata returns descriptive metadata for a provider/model pair.

type ModelPricingSpec added in v0.11.5

type ModelPricingSpec = model.ModelPricingSpec

ModelPricingSpec contains pricing metadata for a registered model.

func GetModelPricing added in v0.11.5

func GetModelPricing(provider, modelID string) (ModelPricingSpec, bool)

GetModelPricing returns pricing information for a provider/model pair.

type ModelProvider

type ModelProvider = model.Provider

ModelProvider resolves model names to Model instances.

type ModelRequest

type ModelRequest = model.Request

ModelRequest is the structured request sent to a model provider.

type ModelResponse

type ModelResponse = model.Response

ModelResponse is the raw, structured response returned by a model provider after a non-streaming call.

type ModelSettings

type ModelSettings = model.Settings

ModelSettings configures model-level parameters (temperature, top-p, …).

type ModelSpec added in v0.11.5

type ModelSpec = model.ModelSpec

ModelSpec is the complete, unified specification for a registered model.

func GetModelSpec added in v0.11.5

func GetModelSpec(provider, modelID string) (ModelSpec, bool)

GetModelSpec returns the complete registered specification for a model.

func ModelSpecsForProvider added in v0.11.5

func ModelSpecsForProvider(provider string) []ModelSpec

ModelSpecsForProvider returns all registered models for the provider.

type NetworkConfig added in v0.11.5

type NetworkConfig = network.NetworkConfig

NetworkConfig configures a multi-agent network execution.

func NewNetworkConfig added in v0.11.5

func NewNetworkConfig() NetworkConfig

NewNetworkConfig creates a default multi-agent network configuration.

type NetworkResult added in v0.11.5

type NetworkResult = network.NetworkResult

NetworkResult is the aggregated result of a network execution.

type NetworkRunner added in v0.11.5

type NetworkRunner = network.NetworkRunner

NetworkRunner executes a multi-agent network.

func NewNetworkRunner added in v0.11.5

func NewNetworkRunner(base *Runner) *NetworkRunner

NewNetworkRunner creates a multi-agent network runner from a base runner.

type NetworkStreamEvent added in v0.11.4

type NetworkStreamEvent = network.NetworkStreamEvent

NetworkStreamEvent is a single event emitted during a multi-agent network streaming run.

type NetworkStreamEventType added in v0.11.5

type NetworkStreamEventType = network.NetworkStreamEventType

NetworkStreamEventType identifies a streamed network event.

type NoopTracer added in v0.11.5

type NoopTracer = tracing.NoopTracer

NoopTracer is a tracer implementation that discards all events.

type OpenAIAPIType added in v0.11.5

type OpenAIAPIType = openaiprovider.APIType

OpenAIAPIType identifies the OpenAI transport mode.

type OpenAIProvider added in v0.11.5

type OpenAIProvider = openaiprovider.Provider

OpenAIProvider is the public OpenAI provider type.

func NewOpenAIProvider added in v0.11.5

func NewOpenAIProvider(apiKey string) *OpenAIProvider

NewOpenAIProvider creates an OpenAI provider with default settings.

type OutputGuardrail

type OutputGuardrail = runner.OutputGuardrail

OutputGuardrail validates agent output after each model call.

type Plugin

type Plugin = plugin.Plugin

Plugin is a bundle of tools, skills, and MCP servers pluggable to an agent.

type PluginRegistry

type PluginRegistry = plugin.Registry

PluginRegistry manages registered plugins.

func NewPluginRegistry

func NewPluginRegistry() *PluginRegistry

NewPluginRegistry creates a new plugin registry.

type Provider added in v0.11.5

type Provider = model.Provider

Provider resolves a model name to an executable model instance.

type ProviderSpec added in v0.11.5

type ProviderSpec = model.ProviderSpec

ProviderSpec describes a model provider.

func AllProviders added in v0.11.5

func AllProviders() []ProviderSpec

AllProviders returns the registered provider list.

func GetProvider added in v0.11.5

func GetProvider(id string) (ProviderSpec, bool)

GetProvider returns public metadata for a model provider.

type RecoveryConfig

type RecoveryConfig = runner.RecoveryConfig

RecoveryConfig controls automatic recovery from panics and transient failures.

type Request added in v0.11.5

type Request = model.Request

Request is the structured input passed to a model.

type Response added in v0.11.5

type Response = model.Response

Response is the structured output returned by a model.

type RetryConfig

type RetryConfig = runner.RetryConfig

RetryConfig configures automatic retries for tool calls and handoffs.

type RunConfig

type RunConfig = runner.RunConfig

RunConfig holds global, run-level configuration overrides such as model, provider, guardrails, and tracing settings.

type RunOptions

type RunOptions = runner.RunOptions

RunOptions configures a single invocation of Runner.Run or Runner.RunStreaming.

type RunResult

type RunResult = result.RunResult

RunResult is the final result of a completed non-streaming run.

type Runner

type Runner = runner.Runner

Runner executes agents, managing the turn loop, tool execution, and agent-to-agent handoffs.

func NewRunner

func NewRunner() *Runner

NewRunner creates a new Runner with default configuration (max 10 turns).

type Settings added in v0.11.5

type Settings = model.Settings

Settings configures model-level options such as temperature and max tokens.

type Skill

type Skill = skill.Skill

Skill is a markdown document with a YAML header, loadable by an agent via the load_skill tool.

func LoadSkillFromFile

func LoadSkillFromFile(path string) (Skill, error)

LoadSkillFromFile loads a skill from a markdown file with YAML frontmatter.

func LoadSkillFromReader

func LoadSkillFromReader(r io.Reader) (Skill, error)

LoadSkillFromReader loads a skill from an io.Reader.

func LoadSkillFromString

func LoadSkillFromString(content string) (Skill, error)

LoadSkillFromString loads a skill from a raw markdown string.

type SkillHeader

type SkillHeader = skill.Header

SkillHeader contains skill metadata (name, description, version).

type SkillRegistry

type SkillRegistry = skill.Registry

SkillRegistry manages skill discovery and storage.

func NewSkillRegistry

func NewSkillRegistry() *SkillRegistry

NewSkillRegistry creates a new skill registry.

type StateManagementConfig

type StateManagementConfig = runner.StateManagementConfig

StateManagementConfig configures workflow-state persistence and checkpoint frequency.

type StreamEvent

type StreamEvent = model.StreamEvent

StreamEvent is a single low-level event emitted during a streaming run.

type StreamEventRecord added in v0.11.4

type StreamEventRecord = streaming.StreamEventRecord

StreamEventRecord is a coalesced entry in the enriched streaming event timeline.

func CoalesceEvents added in v0.11.4

func CoalesceEvents(events []StreamEventRecord) []StreamEventRecord

CoalesceEvents merges consecutive compatible streaming timeline records.

type StreamResult added in v0.11.4

type StreamResult = streaming.StreamResult

StreamResult aggregates content, thinking, usage, and tool lifecycle data from an enriched streaming run.

func Enrich added in v0.11.4

func Enrich(raw <-chan StreamEvent, bufferSize int) (<-chan StreamingEvent, *StreamResult)

Enrich converts raw streaming events into higher-level streaming events with thinking extraction, tool lifecycle tracking, and aggregated results.

func EnrichNetworkStream added in v0.11.4

func EnrichNetworkStream(raw <-chan NetworkStreamEvent, bufferSize int) (<-chan StreamingEvent, *StreamResult)

EnrichNetworkStream converts multi-agent network streaming events into higher-level streaming events with agent lifecycle tracking and aggregated results.

type StreamedRunResult

type StreamedRunResult = result.StreamedRunResult

StreamedRunResult is the handle returned by Runner.RunStreaming. Consume events from its Stream channel, then read FinalOutput when done.

type StreamingEvent added in v0.11.4

type StreamingEvent = streaming.Event

StreamingEvent is a higher-level event emitted by the enriched streaming helpers.

type Tool

type Tool = tool.Tool

Tool is the interface every agent tool must satisfy.

func MCPToolsFromServer added in v0.11.1

func MCPToolsFromServer(ctx context.Context, server MCPServerConfig) ([]Tool, error)

MCPToolsFromServer discovers all tools from an MCP server and returns them as standard tool.Tool values, ready to be attached to an agent.

func NewLoadSkillTool added in v0.11.1

func NewLoadSkillTool(skills []Skill) Tool

NewLoadSkillTool creates a tool that allows an agent to load the full content of a skill by name at runtime.

func WithToolMiddleware

func WithToolMiddleware(t Tool, mw ...ToolMiddleware) Tool

WithToolMiddleware wraps a tool with one or more middleware layers.

type ToolCall added in v0.11.5

type ToolCall = model.ToolCall

ToolCall represents a function/tool invocation requested by the model.

type ToolCallRecord added in v0.11.4

type ToolCallRecord = streaming.ToolCallRecord

ToolCallRecord tracks a single tool invocation and its outcome during an enriched streaming run.

type ToolDataBus added in v0.12.0

type ToolDataBus = tooldata.ToolDataBus

ToolDataBus is a request-scoped, thread-safe store for large binary payloads that must reach tool handlers without transiting through the LLM context. It lives for the duration of a single RunStreaming call.

func NewToolDataBus added in v0.12.0

func NewToolDataBus() *ToolDataBus

NewToolDataBus creates an empty ToolDataBus.

func ToolDataBusFromContext added in v0.12.0

func ToolDataBusFromContext(ctx context.Context) *ToolDataBus

ToolDataBusFromContext extracts the ToolDataBus from ctx. Returns nil if no bus is present — callers must handle nil.

type ToolMiddleware

type ToolMiddleware = tool.Middleware

ToolMiddleware wraps a Tool with additional behavior.

type ToolRegistry

type ToolRegistry = tool.Registry

ToolRegistry is a thread-safe tool registry with group support.

func NewToolRegistry

func NewToolRegistry() *ToolRegistry

NewToolRegistry creates a new thread-safe tool registry with group support.

type Tracer added in v0.11.5

type Tracer = tracing.Tracer

Tracer is the interface implemented by tracing backends.

func GetGlobalTracer added in v0.11.5

func GetGlobalTracer() Tracer

GetGlobalTracer returns the process-wide tracer.

type TracingConfig

type TracingConfig = runner.TracingConfig

TracingConfig carries metadata forwarded to the active tracer.

type Usage

type Usage = model.Usage

Usage holds token-consumption data reported by a model provider.

type ValidationConfig

type ValidationConfig = runner.ValidationConfig

ValidationConfig holds the set of rules applied before and after handoffs.

type ValidationRule

type ValidationRule = runner.ValidationRule

ValidationRule defines a predicate applied to data at handoff boundaries.

type ValidationSeverity

type ValidationSeverity = runner.ValidationSeverity

ValidationSeverity indicates whether a failed rule blocks progress or only emits a warning.

type WorkflowConfig

type WorkflowConfig = runner.WorkflowConfig

WorkflowConfig controls retry, state management, validation, and recovery behavior for multi-agent workflows.

type WorkflowState

type WorkflowState = runner.WorkflowState

WorkflowState tracks the current phase and artifacts of a running multi-phase workflow.

type WorkflowStateStore

type WorkflowStateStore = runner.WorkflowStateStore

WorkflowStateStore is the interface for persisting and restoring workflow state across checkpoints.

Directories

Path Synopsis
examples
gemini_example command
lmstudio_example command
Package main demonstrates the agent-sdk-go using a local LM Studio server.
Package main demonstrates the agent-sdk-go using a local LM Studio server.
mcp_integration command
mcp_live_server command
Package main demonstrates end-to-end MCP (Model Context Protocol) communication using the SDK's HTTP client and a local JSON-RPC 2.0 test server.
Package main demonstrates end-to-end MCP (Model Context Protocol) communication using the SDK's HTTP client and a local JSON-RPC 2.0 test server.
mistral_example command
openai_example command
plugin_bundle command
skill_loading command
skills_runtime command
Package main demonstrates end-to-end skill loading and runtime behavior.
Package main demonstrates end-to-end skill loading and runtime behavior.
tool_registry command
tools_execution command
Package main demonstrates end-to-end tool execution using the SDK.
Package main demonstrates end-to-end tool execution using the SDK.
pkg
mcp
plugin
Package plugin provides a bundle abstraction that groups tools, skills, and MCP servers into a single pluggable unit for agents.
Package plugin provides a bundle abstraction that groups tools, skills, and MCP servers into a single pluggable unit for agents.
streaming
Package streaming provides enriched event streaming for agent-sdk-go.
Package streaming provides enriched event streaming for agent-sdk-go.
scripts
test

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL