Documentation
¶
Index ¶
- Variables
- func NewOutputFormatJSONSchema(v any, strict bool) map[string]any
- func NewOutputSchema(v any) map[string]any
- func NewRedisStreamBroker(redisEndpoint string, password string, db int) (agents.StreamBroker, error)
- func NewRoutineService(registry *AgentRegistry, store routines.Store) *routines.Service
- func NewStreamBroker() (agents.StreamBroker, error)
- func NewWorkflowHTTPHandler(registry *AgentRegistry, config workflow.HTTPConfig) *workflow.HTTPHandler
- func UserTurn(text string) history.Message
- type APIKeyConfig
- type Agent
- type AgentConfig
- type AgentMiddleware
- type AgentOption
- type AgentRegistry
- func (r *AgentRegistry) Agent(name string) (*agents.Agent, bool)
- func (r *AgentRegistry) AgentNames() []string
- func (r *AgentRegistry) Register(agent *Agent) error
- func (r *AgentRegistry) RegisterWorkflow(name string, compiled *workflow.Compiled, options ...workflow.InvokeOption) error
- func (r *AgentRegistry) RunWorkflow(ctx context.Context, name string, in *workflow.Input, ...) (*workflow.Input, error)
- func (r *AgentRegistry) Workflow(name string) (*workflow.Compiled, bool)
- func (r *AgentRegistry) WorkflowNames() []string
- type BackgroundFunctionTool
- func (t *BackgroundFunctionTool[T, S]) AwaitTask(ctx context.Context, task BackgroundTaskRef, progress ProgressReporter) (agents.BackgroundResult, error)
- func (t *BackgroundFunctionTool[T, S]) Execute(_ context.Context, params *agents.ToolCall) (*agents.ToolCallResponse, error)
- func (t *BackgroundFunctionTool[T, S]) SetStartedMessage(fn func(taskID string) string)
- type BackgroundTaskRef
- type BackgroundToolFunc
- type Config
- type FunctionTool
- func (t *FunctionTool[T, S]) Execute(ctx context.Context, params *agents.ToolCall) (*agents.ToolCallResponse, error)
- func (t *FunctionTool[T, S]) GetAnnotations() *agents.ToolAnnotations
- func (t *FunctionTool[T, S]) GetMeta() map[string]any
- func (t *FunctionTool[T, S]) GetToolDescriptor() *agents.BaseTool
- func (t *FunctionTool[T, S]) SetAnnotations(annotations *agents.ToolAnnotations)
- func (t *FunctionTool[T, S]) SetDeferred(deferred bool)
- func (t *FunctionTool[T, S]) SetDescription(description string)
- func (t *FunctionTool[T, S]) SetMeta(meta map[string]any)
- func (t *FunctionTool[T, S]) SetName(name string)
- func (t *FunctionTool[T, S]) SetNeedsApproval(needsApproval bool)
- type HTTPHandler
- type Handoff
- type History
- type HistoryMiddleware
- type Input
- type LLMClient
- type LLMOption
- type ListedSkill
- type MCPStore
- type Message
- type Middleware
- type Model
- type ModelCallMiddleware
- type ModelParameters
- type OutputSchema
- type ProgressReporter
- type PromptMiddleware
- type ProviderConfig
- type ProviderName
- type RestateRuntime
- func (r *RestateRuntime) Bind(snapshot *agentconfig.Snapshot) agents.Runtime
- func (r *RestateRuntime) Close() error
- func (r *RestateRuntime) RegisterAgent(options *agents.AgentOptions) error
- func (r *RestateRuntime) RegisterBuilder(builder *agentconfig.Builder) error
- func (r *RestateRuntime) Serve(ctx context.Context, address string) error
- func (r *RestateRuntime) StreamBroker() agents.StreamBroker
- type Result
- type RunHandle
- type Skill
- type SkillClient
- type SkillSelection
- type SkillStore
- type TemporalRuntime
- func (r *TemporalRuntime) Bind(snapshot *agentconfig.Snapshot) agents.Runtime
- func (r *TemporalRuntime) Close() error
- func (r *TemporalRuntime) RegisterAgent(options *agents.AgentOptions) error
- func (r *TemporalRuntime) RegisterBuilder(builder *agentconfig.Builder) error
- func (r *TemporalRuntime) Serve(ctx context.Context) error
- func (r *TemporalRuntime) StreamBroker() agents.StreamBroker
- type Tool
- type ToolAnnotations
- type ToolCallMiddleware
- type ToolConfig
- type ToolFunc
- type ToolOption
- func WithAnnotations(annotations *agents.ToolAnnotations) ToolOption
- func WithDeferred(deferred bool) ToolOption
- func WithDescription(desc string) ToolOption
- func WithDestructive(destructive bool) ToolOption
- func WithIdempotent(idempotent bool) ToolOption
- func WithMeta(meta map[string]any) ToolOption
- func WithName(name string) ToolOption
- func WithNeedsApproval(needsApproval bool) ToolOption
- func WithOpenWorld(openWorld bool) ToolOption
- func WithReadOnly(readOnly bool) ToolOption
- func WithStartedMessage(fn func(taskID string) string) ToolOption
- func WithTitle(title string) ToolOption
- type ToolProgress
Constants ¶
This section is empty.
Variables ¶
var ( ProviderOpenAI = llm.ProviderNameOpenAI ProviderAnthropic = llm.ProviderNameAnthropic ProviderBedrock = llm.ProviderNameBedrock ProviderElevenLabs = llm.ProviderNameElevenLabs ProviderGemini = llm.ProviderNameGemini ProviderXAI = llm.ProviderNameXAI ProviderOllama = llm.ProviderNameOllama ProviderOpenRouter = llm.ProviderNameOpenRouter ProviderSarvam = llm.ProviderNameSarvam ProviderDeepSeek = llm.ProviderNameDeepSeek ProviderMoonshot = llm.ProviderNameMoonshot // Kimi models ProviderZAI = llm.ProviderNameZAI // GLM models )
var ErrAgentAlreadyRegistered = errors.New("agent already registered")
ErrAgentAlreadyRegistered indicates a duplicate name in one registry.
var ErrStreamOverflow = agents.ErrStreamOverflow
var ErrWorkflowAlreadyRegistered = workflow.ErrAlreadyRegistered
ErrWorkflowAlreadyRegistered indicates a duplicate workflow name in a registry.
var FilterMCPStore = mcpclient.Filter
FilterMCPStore lists only the named servers of an MCP config store, each narrowed to the tools its ToolFilter allows.
var FilterSkillStore = skills.Filter
FilterSkillStore lists only the named skills of a store.
var NewDirSkillStore = skills.NewDirStore
NewDirSkillStore serves a folder of skills, rediscovered on every listing.
var NewFSSkillStore = skills.NewFSStore
NewFSSkillStore supports embed.FS and other io/fs implementations.
var NewHandoff = agents.NewHandoff
var NewMCPClient = mcpclient.NewClient
NewMCPClient reads global servers from a built-in store, such as an InlineStore, and each namespace's own from the store WithUserMCPStore gives.
var NewPrompt = prompts.New
var NewPromptWithLoader = prompts.NewWithLoader
var NewSkillClient = skills.NewClient
NewSkillClient reads global skills from a built-in store, such as a folder, and each namespace's own from the store WithUserSkillStore gives, such as one of users' uploads.
var WithMCPCredentials = mcpclient.WithCredentials
WithMCPCredentials supplies an MCP client's shared credential resolution.
var WithMCPSchemaCache = mcpclient.WithSchemaCache
WithMCPSchemaCache supplies an MCP client's shared discovery caching.
var WithUserMCPStore = mcpclient.WithUserStore
WithUserMCPStore reads each namespace's own MCP servers from a store.
var WithUserSkillStore = skills.WithUserStore
WithUserSkillStore reads each namespace's own skills from a store.
Functions ¶
func NewOutputSchema ¶
func NewRedisStreamBroker ¶
func NewRoutineService ¶ added in v0.0.17
func NewRoutineService(registry *AgentRegistry, store routines.Store) *routines.Service
NewRoutineService creates scheduled tasks targeting agents from this registry, which every namespace shares. For agents namespaces create at run time, use routines.NewService(store, &routines.AgentExecutor{Registry: agentconfigRegistry}). Share the service between routines.NewHTTPHandler, routines.Tools, and a routines.Scheduler implementation. The application owns the store and scheduler lifetime.
func NewStreamBroker ¶
func NewStreamBroker() (agents.StreamBroker, error)
func NewWorkflowHTTPHandler ¶ added in v0.0.17
func NewWorkflowHTTPHandler(registry *AgentRegistry, config workflow.HTTPConfig) *workflow.HTTPHandler
NewWorkflowHTTPHandler serves independent workflow start/status/resume routes. Keep the returned handler for the server's lifetime: it owns bounded, in-memory HTTP run checkpoints. It does not require an agent or model.
Types ¶
type APIKeyConfig ¶
type APIKeyConfig = gateway.APIKeyConfig
type Agent ¶
func MustNewAgent ¶ added in v0.0.17
func MustNewAgent(cfg *AgentConfig, opts ...AgentOption) *Agent
MustNewAgent is NewAgent for static configuration where failure is a programmer error.
func NewAgent ¶
func NewAgent(cfg *AgentConfig, opts ...AgentOption) (*Agent, error)
NewAgent validates configuration, constructs an agent, and registers its resolved configuration with the supplied runtime before returning. History, runtime and broker resources remain owned by the caller.
type AgentConfig ¶
type AgentConfig struct {
Name string
LLM llm.Provider
Output map[string]any
Tools []Tool
Handoffs []*agents.Handoff
MCPClient agents.MCPClient
MaxLoops *int
History *history.CommonConversationManager
Instruction agents.SystemPromptProvider
Parameters responses.Parameters
StickyHandoff bool
// SkillClient lists the agent's global skills plus the namespace's own, and
// serves enabled ones through read_skill. See skills.NewClient.
SkillClient agents.SkillClient
// ClientTools configures tools the client runs itself (AG-UI frontend
// tools): how long a call waits for the client's result before the run
// pauses on it. The zero value waits agents.DefaultClientToolTimeout.
ClientTools agents.ClientToolOptions
// Middlewares wrap model/tool calls, history loads/saves and prompt
// retrieval. Embed agents.NoopMiddleware and override selected methods.
Middlewares []agents.Middleware
}
type AgentMiddleware ¶ added in v0.0.17
type AgentMiddleware = agents.Middleware
AgentMiddleware wraps agent operations. Embed agents.NoopMiddleware and override the Wrap methods relevant to your implementation. The root Middleware alias remains the gateway/provider middleware API.
type AgentOption ¶
type AgentOption func(options *agents.AgentOptions)
func WithRuntime ¶
func WithRuntime(runtime agents.Runtime) AgentOption
WithRuntime selects a runtime and uses its StreamBroker. A nil runtime uses local execution with a default in-memory broker. NewAgent registers the resolved configuration with the runtime; start Temporal/Restate workers with Serve.
type AgentRegistry ¶
type AgentRegistry struct {
// contains filtered or unexported fields
}
AgentRegistry is an instance-owned, concurrency-safe registry of agents and workflows. Its zero value is ready to use. Names and registered graphs must not be mutated after registration.
func NewRegistry ¶ added in v0.0.17
func NewRegistry() *AgentRegistry
func (*AgentRegistry) AgentNames ¶
func (r *AgentRegistry) AgentNames() []string
func (*AgentRegistry) Register ¶ added in v0.0.17
func (r *AgentRegistry) Register(agent *Agent) error
func (*AgentRegistry) RegisterWorkflow ¶ added in v0.0.17
func (r *AgentRegistry) RegisterWorkflow(name string, compiled *workflow.Compiled, options ...workflow.InvokeOption) error
RegisterWorkflow registers an independently invokable workflow alongside agents.
func (*AgentRegistry) RunWorkflow ¶ added in v0.0.17
func (r *AgentRegistry) RunWorkflow(ctx context.Context, name string, in *workflow.Input, options ...workflow.InvokeOption) (*workflow.Input, error)
RunWorkflow executes or resumes a workflow by its registered name.
func (*AgentRegistry) Workflow ¶ added in v0.0.17
func (r *AgentRegistry) Workflow(name string) (*workflow.Compiled, bool)
func (*AgentRegistry) WorkflowNames ¶ added in v0.0.17
func (r *AgentRegistry) WorkflowNames() []string
type BackgroundFunctionTool ¶ added in v0.0.17
type BackgroundFunctionTool[T any, S any] struct { *FunctionTool[T, S] // contains filtered or unexported fields }
BackgroundFunctionTool is NewTool for work that does not finish inside the call. See NewBackgroundTool.
func NewBackgroundTool ¶ added in v0.0.17
func NewBackgroundTool[T any, S any](work BackgroundToolFunc[T, S], opts ...ToolOption) *BackgroundFunctionTool[T, S]
NewBackgroundTool turns a long-running func into a tool that answers at once and reports its result when it is done.
indexTool := hastekit.NewBackgroundTool(
func(ctx context.Context, in IndexArgs, progress hastekit.ProgressReporter) (IndexResult, error) {
for i, doc := range in.Docs {
progress.Report(ctx, hastekit.ToolProgress{
Progress: float64(i), Total: float64(len(in.Docs)), Message: doc.Name,
})
index(doc)
}
return IndexResult{Indexed: len(in.Docs)}, nil
},
hastekit.WithName("index_docs"),
hastekit.WithDescription("Index documents. Takes a while."),
)
The model gets an immediate answer naming the task, the run carries on, and whatever the func returns is delivered to the thread when it returns — into the run that started it if that is still going, otherwise as a new run.
The work runs off the run's path, not inside it: in this process that means a goroutine of the agent's, and under Temporal or Restate the activity or invocation that runtime keeps for the task. That is why the func is given the arguments rather than closing over them — it may well run somewhere the call that started it never reached. Anything else it needs must travel the same way, in the arguments.
Progress is nil-safe: report freely, whether or not anyone is listening.
The return value is encoded like an ordinary tool's, unless it already is a tool output — a *responses.FunctionCallOutputMessage, a FunctionCallOutputContentUnion, or a responses.InputContent — in which case it travels as it is. That is how a task answers with an image or a file.
For work that has to be *started* now and only watched later — a job queued with another service, say — implement agents.BackgroundTool directly, which splits starting from waiting.
func (*BackgroundFunctionTool[T, S]) AwaitTask ¶ added in v0.0.17
func (t *BackgroundFunctionTool[T, S]) AwaitTask(ctx context.Context, task BackgroundTaskRef, progress ProgressReporter) (agents.BackgroundResult, error)
AwaitTask runs the work. This is where the tool actually does its job, on whatever the runtime keeps alive past the call that started it.
func (*BackgroundFunctionTool[T, S]) Execute ¶ added in v0.0.17
func (t *BackgroundFunctionTool[T, S]) Execute(_ context.Context, params *agents.ToolCall) (*agents.ToolCallResponse, error)
Execute starts the task: it answers immediately with a task id, and keeps the call's arguments for the wait.
func (*BackgroundFunctionTool[T, S]) SetStartedMessage ¶ added in v0.0.17
func (t *BackgroundFunctionTool[T, S]) SetStartedMessage(fn func(taskID string) string)
type BackgroundTaskRef ¶ added in v0.0.17
type BackgroundTaskRef = agents.BackgroundTaskRef
BackgroundTaskRef identifies a running background task to the tool that started it.
type BackgroundToolFunc ¶ added in v0.0.17
type BackgroundToolFunc[T any, S any] func(ctx context.Context, in T, progress ProgressReporter) (S, error)
BackgroundToolFunc is the work a background tool does. It is handed the call's arguments and somewhere to report progress, and runs for as long as it needs to — the run that called the tool is long gone by the time it returns.
type Config ¶
type Config struct {
// ProviderConfigs is the provider configs, used for LLM calls
ProviderConfigs []ProviderConfig
}
type FunctionTool ¶
func NewTool ¶
func NewTool[T any, S any](fn ToolFunc[T, S], opts ...ToolOption) *FunctionTool[T, S]
func (*FunctionTool[T, S]) Execute ¶
func (t *FunctionTool[T, S]) Execute(ctx context.Context, params *agents.ToolCall) (*agents.ToolCallResponse, error)
func (*FunctionTool[T, S]) GetAnnotations ¶
func (t *FunctionTool[T, S]) GetAnnotations() *agents.ToolAnnotations
GetAnnotations implements ToolConfig, which is how the per-hint options (WithReadOnly, WithDestructive, ...) amend the set rather than clobber it.
func (*FunctionTool[T, S]) GetMeta ¶ added in v0.0.14
func (t *FunctionTool[T, S]) GetMeta() map[string]any
GetMeta implements ToolConfig, letting WithMeta add to what is already there.
func (*FunctionTool[T, S]) GetToolDescriptor ¶ added in v0.0.16
func (t *FunctionTool[T, S]) GetToolDescriptor() *agents.BaseTool
GetToolDescriptor implements agents.Tool. A function tool keeps its state in its own fields rather than an embedded BaseTool, so the projection is built here — schema included, from the input type's own shape. Name is left empty: the tool has one name, and it is the one in ToolUnion.
func (*FunctionTool[T, S]) SetAnnotations ¶
func (t *FunctionTool[T, S]) SetAnnotations(annotations *agents.ToolAnnotations)
SetAnnotations replaces the tool's annotations wholesale. The hint options (WithReadOnly, WithDestructive, ...) go through here too, each filling in one field of the current set.
func (*FunctionTool[T, S]) SetDeferred ¶
func (t *FunctionTool[T, S]) SetDeferred(deferred bool)
func (*FunctionTool[T, S]) SetDescription ¶
func (t *FunctionTool[T, S]) SetDescription(description string)
func (*FunctionTool[T, S]) SetMeta ¶ added in v0.0.14
func (t *FunctionTool[T, S]) SetMeta(meta map[string]any)
func (*FunctionTool[T, S]) SetName ¶
func (t *FunctionTool[T, S]) SetName(name string)
func (*FunctionTool[T, S]) SetNeedsApproval ¶
func (t *FunctionTool[T, S]) SetNeedsApproval(needsApproval bool)
type HTTPHandler ¶
type HTTPHandler struct {
// contains filtered or unexported fields
}
func NewHTTPHandler ¶
func NewHTTPHandler(registry *AgentRegistry) *HTTPHandler
func (*HTTPHandler) ServeHTTP ¶
func (h *HTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type History ¶
type History = history.CommonConversationManager
func MustNewFileHistory ¶ added in v0.0.17
func MustNewFileHistory(path string, opts ...history.ConversationManagerOptions) *History
MustNewFileHistory panics if the history cannot be opened. Prefer OpenFileHistory when the application can recover from initialization errors.
func NewFileHistory ¶
func NewFileHistory(path string, opts ...history.ConversationManagerOptions) (*History, error)
NewFileHistory opens file-backed history. The caller must Close it after all agents sharing it have finished. Agents never close caller-owned history.
func OpenFileHistory ¶ added in v0.0.17
func OpenFileHistory(path string, opts ...history.ConversationManagerOptions) (*History, error)
OpenFileHistory is an alias for NewFileHistory.
type HistoryMiddleware ¶ added in v0.0.17
type HistoryMiddleware = agents.HistoryMiddleware
type LLMClient ¶
type LLMClient struct {
// contains filtered or unexported fields
}
func NewLLMClient ¶
func NewLLMClient(configs []ProviderConfig, opts ...LLMOption) *LLMClient
NewLLMClient configures the providers a client can reach, and the middleware every model bound off it calls through.
func (*LLMClient) Model ¶
Model binds a "Provider/model" id to a provider the agent can call.
With no options it inherits the client's middleware. WithMiddleware replaces that chain wholesale for this one model — there is no merging, because a chain is an ordered whole and picking entries out of one by type would not survive middleware you wrote yourself:
fast := client.Model("OpenAI/gpt-4o-mini")
critical := client.Model("OpenAI/gpt-4o", hastekit.WithMiddleware(
middleware.NewFallbackModels("Anthropic/claude-opus-4-5"),
middleware.NewRetry(middleware.RetryConfig{MaxAttempts: 5}),
))
judge := client.Model("OpenAI/gpt-4o", hastekit.WithoutMiddleware())
A model naming its own chain builds one, so bind a model once at setup rather than per request.
type LLMOption ¶ added in v0.0.17
type LLMOption func(*llmOptions)
LLMOption configures the middleware a client, or one model bound off it, calls through.
func WithMiddleware ¶ added in v0.0.17
func WithMiddleware(m ...Middleware) LLMOption
WithMiddleware sets the chain, outermost first.
client := hastekit.NewLLMClient(configs, hastekit.WithMiddleware(
middleware.NewFallbackModels("Anthropic/claude-sonnet-4-5"),
middleware.NewRetry(middleware.RetryConfig{}),
))
Order is yours to choose and it matters.
Middleware needing the provider configuration receives it when the chain is installed, so nothing here has to be handed a config store.
func WithoutMiddleware ¶ added in v0.0.17
func WithoutMiddleware() LLMOption
WithoutMiddleware drops the chain, leaving only tracing. On a model it overrides the client's — an LLM judge, say, which should be held to exactly what the provider did on the first attempt, under a client that retries.
type ListedSkill ¶ added in v0.0.17
type ListedSkill = agents.ListedSkill
type MCPStore ¶ added in v0.0.31
MCPStore lists MCP server definitions by namespace — see mcpclient.Store. An MCP client reads one as its built-in store and one as its user store.
type Message ¶ added in v0.0.17
type Message = responses.InputMessageUnion
type Middleware ¶ added in v0.0.17
type Middleware = gateway.Middleware
Middleware wraps every call a client makes to a provider — retries, fallback, tracing, or anything you write yourself. Build the built-in ones with the constructors in pkg/gateway/middleware.
type ModelCallMiddleware ¶ added in v0.0.17
type ModelCallMiddleware = agents.ModelCallMiddleware
ModelCallMiddleware wraps a call to the model — see agents.ModelCallMiddleware.
type ModelParameters ¶
type ModelParameters = responses.Parameters
type OutputSchema ¶
type OutputSchema = jsonschema.Schema
type ProgressReporter ¶ added in v0.0.17
type ProgressReporter = agents.ProgressReporter
ProgressReporter is how a running tool says how far along it is.
type PromptMiddleware ¶ added in v0.0.17
type PromptMiddleware = agents.PromptMiddleware
type ProviderConfig ¶
type ProviderConfig = gateway.ProviderConfig
type ProviderName ¶
type ProviderName = llm.ProviderName
type RestateRuntime ¶
type RestateRuntime struct {
*restate_runtime.RestateRuntime
// contains filtered or unexported fields
}
func NewRestateRuntime ¶
func NewRestateRuntime(restateEndpoint string, broker agents.StreamBroker) (*RestateRuntime, error)
NewRestateRuntime requires an explicit broker shared by callers and service processes. An in-memory broker is only suitable for a single-process setup.
func (*RestateRuntime) Bind ¶ added in v0.0.31
func (r *RestateRuntime) Bind(snapshot *agentconfig.Snapshot) agents.Runtime
Bind runs a config-built agent's snapshot through the AgentBuilder workflow, making RestateRuntime an agentconfig.Runtime.
func (*RestateRuntime) Close ¶ added in v0.0.17
func (r *RestateRuntime) Close() error
func (*RestateRuntime) RegisterAgent ¶ added in v0.0.17
func (r *RestateRuntime) RegisterAgent(options *agents.AgentOptions) error
RegisterAgent registers an agent configuration before Serve starts.
func (*RestateRuntime) RegisterBuilder ¶ added in v0.0.31
func (r *RestateRuntime) RegisterBuilder(builder *agentconfig.Builder) error
RegisterBuilder serves config-built agents from builder, through the one AgentBuilder workflow, so agents written to its stores after Serve starts run durably. Call it before Serve. The builder must stream on this runtime's broker: build it with agentconfig.Dependencies.Runtime set to this runtime.
func (*RestateRuntime) Serve ¶ added in v0.0.17
func (r *RestateRuntime) Serve(ctx context.Context, address string) error
Serve blocks serving Restate invocations at address until ctx ends. The address is the local listen address, separate from the ingress endpoint.
func (*RestateRuntime) StreamBroker ¶ added in v0.0.17
func (r *RestateRuntime) StreamBroker() agents.StreamBroker
StreamBroker returns the broker configured for this runtime.
type Result ¶ added in v0.0.17
type Result = agents.AgentOutput
type RunHandle ¶ added in v0.0.17
type RunHandle = agents.AgentHandle
type Skill ¶
Skill is one folder of instructions the agent can pull in on demand — see agents.Skill.
type SkillClient ¶ added in v0.0.25
type SkillClient = agents.SkillClient
SkillClient lists an agent's global and namespace skills — see skills.Client.
type SkillSelection ¶ added in v0.0.17
type SkillSelection = agents.SkillSelection
type SkillStore ¶ added in v0.0.31
SkillStore lists and reads skills by namespace — see skills.Store. A skill client reads one as its built-in store and one as its user store.
type TemporalRuntime ¶
type TemporalRuntime struct {
*temporal_runtime.TemporalRuntime
// contains filtered or unexported fields
}
func NewTemporalRuntime ¶
func NewTemporalRuntime(temporalEndpoint string, broker agents.StreamBroker) (*TemporalRuntime, error)
NewTemporalRuntime requires an explicit broker. Use a shared broker such as Redis when the caller and workers run in different processes.
func (*TemporalRuntime) Bind ¶ added in v0.0.31
func (r *TemporalRuntime) Bind(snapshot *agentconfig.Snapshot) agents.Runtime
Bind runs a config-built agent's snapshot through the AgentBuilder workflow, making TemporalRuntime an agentconfig.Runtime.
func (*TemporalRuntime) Close ¶ added in v0.0.17
func (r *TemporalRuntime) Close() error
Close stops the worker and closes the client opened by NewTemporalRuntime. Brokers and histories supplied by the caller are not closed.
func (*TemporalRuntime) RegisterAgent ¶ added in v0.0.17
func (r *TemporalRuntime) RegisterAgent(options *agents.AgentOptions) error
RegisterAgent registers an agent configuration before Serve starts.
func (*TemporalRuntime) RegisterBuilder ¶ added in v0.0.31
func (r *TemporalRuntime) RegisterBuilder(builder *agentconfig.Builder) error
RegisterBuilder serves config-built agents from builder, through the one AgentBuilder workflow, so agents written to its stores after Serve starts run durably. Call it before Serve. The builder must stream on this runtime's broker: build it with agentconfig.Dependencies.Runtime set to this runtime.
func (*TemporalRuntime) Serve ¶ added in v0.0.17
func (r *TemporalRuntime) Serve(ctx context.Context) error
Serve runs the worker until ctx ends or startup fails. The caller owns the runtime and must Close it after Serve and outstanding executions finish.
func (*TemporalRuntime) StreamBroker ¶ added in v0.0.17
func (r *TemporalRuntime) StreamBroker() agents.StreamBroker
StreamBroker returns the broker configured for this runtime.
type ToolAnnotations ¶
type ToolAnnotations = agents.ToolAnnotations
ToolAnnotations describes what a tool does — read-only, destructive, idempotent, open-world — in the same shape MCP servers use, so a function tool and an MCP tool feed the same permission policy.
type ToolCallMiddleware ¶ added in v0.0.17
type ToolCallMiddleware = agents.ToolCallMiddleware
ToolCallMiddleware wraps a tool call — see agents.ToolCallMiddleware.
type ToolConfig ¶
type ToolConfig interface {
SetName(string)
SetDescription(string)
SetNeedsApproval(bool)
SetDeferred(bool)
SetAnnotations(*agents.ToolAnnotations)
// GetAnnotations lets the per-hint options amend the current annotations
// instead of overwriting them, so WithReadOnly and WithIdempotent can be
// passed to the same tool.
GetAnnotations() *agents.ToolAnnotations
SetMeta(map[string]any)
// GetMeta lets WithMeta add to what is already there, for the same reason
// GetAnnotations exists.
GetMeta() map[string]any
}
type ToolOption ¶
type ToolOption func(ToolConfig)
func WithAnnotations ¶
func WithAnnotations(annotations *agents.ToolAnnotations) ToolOption
WithAnnotations sets the tool's behavioural hints in one go. Prefer the single-hint options below unless you already have a full set in hand.
func WithDeferred ¶
func WithDeferred(deferred bool) ToolOption
func WithDescription ¶
func WithDescription(desc string) ToolOption
func WithDestructive ¶
func WithDestructive(destructive bool) ToolOption
WithDestructive declares whether the tool may destroy or overwrite state, as opposed to only adding to it. A tool that says nothing counts as destructive.
func WithIdempotent ¶
func WithIdempotent(idempotent bool) ToolOption
WithIdempotent declares that repeating the call with the same arguments has no additional effect.
func WithMeta ¶ added in v0.0.14
func WithMeta(meta map[string]any) ToolOption
WithMeta attaches metadata to the tool. It is not sent to the model and has no meaning to the SDK: it rides along on the BaseTool, which is what a tool call middleware is shown, so a policy can key off where a tool came from or what it belongs to without having to recognise it by name.
Repeated use merges rather than replaces, so several options can each contribute a key, and a later one wins on a key both set. It works on a copy: a map handed to several tools must not pick up one tool's keys on another.
func WithName ¶
func WithName(name string) ToolOption
func WithNeedsApproval ¶
func WithNeedsApproval(needsApproval bool) ToolOption
func WithOpenWorld ¶
func WithOpenWorld(openWorld bool) ToolOption
WithOpenWorld declares whether the tool reaches outside a closed, known set of entities — a web search does, a lookup in local memory does not.
func WithReadOnly ¶
func WithReadOnly(readOnly bool) ToolOption
WithReadOnly declares that the tool does not modify anything. This is what a permission policy keys off to let a call run unattended, so only claim it when the tool truly has no side effects.
func WithStartedMessage ¶ added in v0.0.17
func WithStartedMessage(fn func(taskID string) string) ToolOption
WithStartedMessage replaces what the model is told the moment the task starts. It is given the task id.
The default says the work has started and that its result will follow, which is the thing the model most needs to know: that there is nothing to wait for and it should carry on.
It applies only to a background tool; on any other tool it does nothing.
func WithTitle ¶
func WithTitle(title string) ToolOption
WithTitle sets a human-readable name for the tool, for UI use. The model still sees the tool by its name.
type ToolProgress ¶ added in v0.0.17
type ToolProgress = agents.ToolProgress
ToolProgress is one progress update. Total is optional; 0 means unknown.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
agents/10_agent_with_sandbox
command
|
|
|
agents/12_agent_handoff
command
|
|
|
agents/14_agent_with_stdio_mcp_tools
command
An agent whose tools come from an MCP server that runs as a child process rather than as a service — the stdio transport.
|
An agent whose tools come from an MCP server that runs as a child process rather than as a service — the stdio transport. |
|
agents/15_dynamic_skills
command
Run from the repository root with OPENAI_API_KEY set.
|
Run from the repository root with OPENAI_API_KEY set. |
|
agents/16_dynamic_agents
command
Dynamic agents: agents as data, created per namespace at run time.
|
Dynamic agents: agents as data, created per namespace at run time. |
|
agents/1_simple_agent
command
|
|
|
agents/2_tool_calling_agent
command
|
|
|
agents/4_agent_with_mcp_tools
command
|
|
|
agents/5_agent_as_a_tool
command
|
|
|
agents/6_human_in_the_loop
command
|
|
|
agents/7_serving_agents
command
|
|
|
agents/8_restate_agent
command
|
|
|
agents/9_temporal_agent
command
|
|
|
embeddings/1_embeddings
command
|
|
|
responses/1_text_generation
command
|
|
|
responses/2_tool_calling
command
|
|
|
responses/3_reasoning
command
|
|
|
responses/4_image_processing
command
|
|
|
responses/5_image_generation
command
|
|
|
responses/6_web_search
command
|
|
|
responses/7_code_execution
command
|
|
|
speech/1_speech
command
|
|
|
workflow/programmatic
command
This example builds and resumes a workflow entirely in Go.
|
This example builds and resumes a workflow entirely in Go. |
|
workflow/temporal
command
Run a local Temporal server first: temporal server start-dev Then: go run ./examples/workflow/temporal
|
Run a local Temporal server first: temporal server start-dev Then: go run ./examples/workflow/temporal |
|
workflow/yaml
command
|
|
|
internal
|
|
|
testutil
Package testutil supplies in-process fixtures for SDK tests.
|
Package testutil supplies in-process fixtures for SDK tests. |
|
pkg
|
|
|
agents/agentconfig
Package agentconfig defines agents as data: a serializable Config, a Registry that finds the configs a namespace can run, and a Builder that turns them into a plain agents.Agent from dependencies held in code.
|
Package agentconfig defines agents as data: a serializable Config, a Registry that finds the configs a namespace can run, and a Builder that turns them into a plain agents.Agent from dependencies held in code. |
|
agents/attachments
Package attachments resolves application-owned immutable files without putting their contents in conversation or workflow state.
|
Package attachments resolves application-owned immutable files without putting their contents in conversation or workflow state. |
|
agents/eval
Package eval runs an agent against a fixed set of cases and scores what it did, so a change to a prompt, a model, or a tool can be measured instead of eyeballed.
|
Package eval runs an agent against a fixed set of cases and scores what it did, so a change to a prompt, a model, or a tool can be measured instead of eyeballed. |
|
agents/runtime/local_runtime
Package local_runtime provides a goroutine-based agent runtime that streams via a StreamBroker, mirroring the structure of the Temporal and Restate runtimes.
|
Package local_runtime provides a goroutine-based agent runtime that streams via a StreamBroker, mirroring the structure of the Temporal and Restate runtimes. |
|
agents/runtime/restate_agent_builder
Package restate_agent_builder runs config-built agents (see agentconfig) on Restate through one generic workflow, so an agent created after the service started runs durably without registering anything.
|
Package restate_agent_builder runs config-built agents (see agentconfig) on Restate through one generic workflow, so an agent created after the service started runs durably without registering anything. |
|
agents/runtime/temporal_agent_builder
Package temporal_agent_builder runs config-built agents (see agentconfig) on Temporal through one generic workflow, so an agent created after the worker started runs durably without registering anything.
|
Package temporal_agent_builder runs config-built agents (see agentconfig) on Temporal through one generic workflow, so an agent created after the worker started runs durably without registering anything. |
|
agents/sandbox/internal/execsandbox
Package execsandbox implements sandbox.Sandbox over a provider's native exec, for containers that run no process of ours.
|
Package execsandbox implements sandbox.Sandbox over a provider's native exec, for containers that run no process of ours. |
|
agents/sandbox/internal/httpapi
Package httpapi contains transport shared by sandbox provider adapters.
|
Package httpapi contains transport shared by sandbox provider adapters. |
|
agents/sandbox/internal/provision
Package provision contains configuration helpers for providers that create their own containers.
|
Package provision contains configuration helpers for providers that create their own containers. |
|
agents/sandbox/internal/sandboxtest
Package sandboxtest checks what a provider's exec path promises against a real container, which is the only place these behaviours can be observed: they come from the container runtime, the shell and the tools in the image.
|
Package sandboxtest checks what a provider's exec path promises against a real container, which is the only place these behaviours can be observed: they come from the container runtime, the shell and the tools in the image. |
|
agents/sandbox/providers/daytona
Package daytona implements sandbox.Provider using Daytona's control and toolbox APIs.
|
Package daytona implements sandbox.Provider using Daytona's control and toolbox APIs. |
|
agents/sandbox/providers/docker
Package docker provisions sandboxes through the Docker Engine API and runs commands in them with its exec API.
|
Package docker provisions sandboxes through the Docker Engine API and runs commands in them with its exec API. |
|
agents/sandbox/providers/e2b
Package e2b uses the E2B lifecycle API and envd's native Connect/file protocols.
|
Package e2b uses the E2B lifecycle API and envd's native Connect/file protocols. |
|
agents/sandbox/providers/k8s
Package k8s provisions sandbox pods with the official Kubernetes client and runs commands in them through the API server's exec subresource.
|
Package k8s provisions sandbox pods with the official Kubernetes client and runs commands in them through the API server's exec subresource. |
|
agents/skills
Package skills persists complete skill bundles independently of agent configuration.
|
Package skills persists complete skill bundles independently of agent configuration. |
|
agui
Package agui implements the AG-UI Protocol (https://github.com/ag-ui-protocol/ag-ui) as a serving surface for agents.
|
Package agui implements the AG-UI Protocol (https://github.com/ag-ui-protocol/ag-ui) as a serving surface for agents. |
|
agui/web
Package web embeds a ready-made browser chat client for the AG-UI protocol and serves it alongside the protocol endpoints.
|
Package web embeds a ready-made browser chat client for the AG-UI protocol and serves it alongside the protocol endpoints. |
|
cache
Package cache provides byte-oriented cache implementations.
|
Package cache provides byte-oriented cache implementations. |
|
gateway/middleware
Package middleware holds the gateway's built-in middleware: tracing, retry, and provider fallback.
|
Package middleware holds the gateway's built-in middleware: tracing, retry, and provider fallback. |
|
gateway/providers/deepseek
Package deepseek is the provider client for DeepSeek.
|
Package deepseek is the provider client for DeepSeek. |
|
gateway/providers/moonshot
Package moonshot is the provider client for Moonshot AI, which serves the Kimi model family.
|
Package moonshot is the provider client for Moonshot AI, which serves the Kimi model family. |
|
gateway/providers/openaicompat
Package openaicompat is a provider client for any service that speaks the OpenAI /chat/completions wire format but does not implement the /responses API — Sarvam, DeepSeek, Kimi (Moonshot) and GLM (Z.ai) today.
|
Package openaicompat is a provider client for any service that speaks the OpenAI /chat/completions wire format but does not implement the /responses API — Sarvam, DeepSeek, Kimi (Moonshot) and GLM (Z.ai) today. |
|
gateway/providers/sarvam
Package sarvam is the provider client for Sarvam AI - chat (the OpenAI-compatible /v1/chat/completions endpoint, bridged to the native Responses shape), text-to-speech and speech-to-text.
|
Package sarvam is the provider client for Sarvam AI - chat (the OpenAI-compatible /v1/chat/completions endpoint, bridged to the native Responses shape), text-to-speech and speech-to-text. |
|
gateway/providers/zai
Package zai is the provider client for Z.ai (Zhipu AI), which serves the GLM model family.
|
Package zai is the provider client for Z.ai (Zhipu AI), which serves the GLM model family. |
|
genai
Package genai holds the OpenTelemetry GenAI semantic-convention attribute keys and well-known values used across the SDK and the gateway.
|
Package genai holds the OpenTelemetry GenAI semantic-convention attribute keys and well-known values used across the SDK and the gateway. |
|
genai/agentcore
Package agentcore exports OpenTelemetry spans to Amazon Bedrock AgentCore / CloudWatch GenAI Observability without an ADOT collector.
|
Package agentcore exports OpenTelemetry spans to Amazon Bedrock AgentCore / CloudWatch GenAI Observability without an ADOT collector. |
|
knowledge/textsplitters
Package textsplitters provides text chunking by character length, token length, and allows adding more advanced strategies (semantic, sentence-aware, etc.) via the TextSplitter interface.
|
Package textsplitters provides text chunking by character length, token length, and allows adding more advanced strategies (semantic, sentence-aware, etc.) via the TextSplitter interface. |
|
routines
Package routines provides persistent scheduled agent tasks.
|
Package routines provides persistent scheduled agent tasks. |