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
- Variables
- func ExtractThinkingText(chunk string) (string, bool)
- func HeadersFromContext(ctx context.Context) map[string]string
- func ProviderSupports(provider, modelID string, cap Capability) bool
- func RecordEvent(ctx context.Context, event Event)
- func SetGlobalTracer(tracer Tracer)
- func UserIDFromContext(ctx context.Context) string
- func WithHeaders(ctx context.Context, headers map[string]string) context.Context
- func WithToolDataBus(ctx context.Context, bus *ToolDataBus) context.Context
- func WithUserID(ctx context.Context, userID string) context.Context
- type Agent
- type AgentRunResult
- type AgentSlot
- type AnthropicProvider
- type BasePlugin
- type Capability
- type ContentPart
- type ContentPartType
- type DefaultAgentHooks
- type DispatchStrategy
- type Event
- type ExecutableTool
- type FileTracer
- type FunctionTool
- type GeminiProvider
- type HandoffCall
- type HandoffInputFilter
- type Hooks
- type InputGuardrail
- type MCPClient
- type MCPClientOptions
- type MCPHTTPClient
- type MCPRegistry
- type MCPServerConfig
- type MCPToolInfo
- type MistralProvider
- type Model
- type ModelCapabilitySet
- type ModelMetadata
- type ModelPricingSpec
- type ModelProvider
- type ModelRequest
- type ModelResponse
- type ModelSettings
- type ModelSpec
- type NetworkConfig
- type NetworkResult
- type NetworkRunner
- type NetworkStreamEvent
- type NetworkStreamEventType
- type NoopTracer
- type OpenAIAPIType
- type OpenAIProvider
- type OutputGuardrail
- type Plugin
- type PluginRegistry
- type Provider
- type ProviderSpec
- type RecoveryConfig
- type Request
- type Response
- type RetryConfig
- type RunConfig
- type RunOptions
- type RunResult
- type Runner
- type Settings
- type Skill
- type SkillHeader
- type SkillRegistry
- type StateManagementConfig
- type StreamEvent
- type StreamEventRecord
- type StreamResult
- type StreamedRunResult
- type StreamingEvent
- type Tool
- type ToolCall
- type ToolCallRecord
- type ToolDataBus
- type ToolMiddleware
- type ToolRegistry
- type Tracer
- type TracingConfig
- type Usage
- type ValidationConfig
- type ValidationRule
- type ValidationSeverity
- type WorkflowConfig
- type WorkflowState
- type WorkflowStateStore
Constants ¶
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.
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.
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.
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 ¶
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
ExtractThinkingText extracts `<think>...</think>` text from a stream chunk, if present.
func HeadersFromContext ¶ added in v0.11.5
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
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
UserIDFromContext extracts the MCP user ID from a context.
func WithHeaders ¶ added in v0.11.5
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.
Types ¶
type Agent ¶
Agent is an AI agent with tools, skills, MCP servers, plugins, handoffs, and lifecycle hooks.
type AgentRunResult ¶ added in v0.11.5
type AgentRunResult = network.AgentRunResult
AgentRunResult is the result of one sub-agent run inside a 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 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 InputGuardrail ¶
type InputGuardrail = runner.InputGuardrail
InputGuardrail validates agent input before each model call.
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 ¶
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 ¶
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 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 ¶
ModelProvider resolves model names to Model instances.
type ModelRequest ¶
ModelRequest is the structured request sent to a model provider.
type ModelResponse ¶
ModelResponse is the raw, structured response returned by a model provider after a non-streaming call.
type ModelSettings ¶
ModelSettings configures model-level parameters (temperature, top-p, …).
type ModelSpec ¶ added in v0.11.5
ModelSpec is the complete, unified specification for a registered model.
func GetModelSpec ¶ added in v0.11.5
GetModelSpec returns the complete registered specification for a model.
func ModelSpecsForProvider ¶ added in v0.11.5
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 PluginRegistry ¶
PluginRegistry manages registered plugins.
func NewPluginRegistry ¶
func NewPluginRegistry() *PluginRegistry
NewPluginRegistry creates a new plugin registry.
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 RetryConfig ¶
type RetryConfig = runner.RetryConfig
RetryConfig configures automatic retries for tool calls and handoffs.
type 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 Runner ¶
Runner executes agents, managing the turn loop, tool execution, and agent-to-agent handoffs.
type Settings ¶ added in v0.11.5
Settings configures model-level options such as temperature and max tokens.
type Skill ¶
Skill is a markdown document with a YAML header, loadable by an agent via the load_skill tool.
func LoadSkillFromFile ¶
LoadSkillFromFile loads a skill from a markdown file with YAML frontmatter.
func LoadSkillFromReader ¶
LoadSkillFromReader loads a skill from an io.Reader.
func LoadSkillFromString ¶
LoadSkillFromString loads a skill from a raw markdown string.
type SkillHeader ¶
SkillHeader contains skill metadata (name, description, version).
type SkillRegistry ¶
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
StreamingEvent is a higher-level event emitted by the enriched streaming helpers.
type 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
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
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 ¶
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
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 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
|
|
|
agent_network_competitive
command
|
|
|
agent_network_parallel
command
|
|
|
agent_network_sequential
command
|
|
|
anthropic_example
command
|
|
|
anthropic_handoff_example
command
|
|
|
azure_openai_example
command
|
|
|
bidirectional_flow_example
command
|
|
|
gemini_example
command
|
|
|
gemini_multi_agent_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
|
|
|
mistral_vision_example
command
|
|
|
multi_agent_example
command
|
|
|
openai_advanced_workflow
command
|
|
|
openai_example
command
|
|
|
openai_multi_agent_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. |
|
typescript_code_review_example
command
|
|
|
pkg
|
|
|
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
|
|
|
sync-model-registry
command
|
|
|
test
|
|