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 NewStreamBroker() (agents.StreamBroker, error)
- type APIKeyConfig
- type Agent
- type AgentConfig
- type AgentOption
- type AgentRegistry
- 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 Hook
- type LLMClient
- type Model
- type ModelCallHook
- type ModelParameters
- type OutputSchema
- type ProviderConfig
- type ProviderName
- type RestateRuntime
- type Skill
- type SkillList
- type SkillProvider
- type SkillRegistry
- type SkillsWithHint
- type TemporalRuntime
- type Tool
- type ToolAnnotations
- type ToolCallHook
- 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 WithTitle(title string) ToolOption
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 (
DefaultStreamBroker = streambroker.NewMemoryStreamBroker()
)
var NewHandoff = agents.NewHandoff
var NewMCPClient = mcpclient.NewClient
var NewPrompt = prompts.New
var NewPromptWithLoader = prompts.NewWithLoader
var NewSkillRegistry = agents.NewSkillRegistry
NewSkillRegistry loads every skill in the given filesystems β an embed.FS, so the skills ship inside the binary, or anything else that implements fs.FS:
//go:embed skills var skillsFS embed.FS registry, err := hastekit.NewSkillRegistry(skillsFS)
var NewSkillRegistryFromDir = agents.NewSkillRegistryFromDir
NewSkillRegistryFromDir loads every skill in a directory on disk:
registry, err := hastekit.NewSkillRegistryFromDir("./skills")
agent := hastekit.NewAgent(&hastekit.AgentConfig{
Instruction: hastekit.NewPrompt("..."),
Skills: registry,
})
Functions ΒΆ
func NewOutputSchema ΒΆ
func NewRedisStreamBroker ΒΆ
func NewStreamBroker ΒΆ
func NewStreamBroker() (agents.StreamBroker, error)
Types ΒΆ
type APIKeyConfig ΒΆ
type APIKeyConfig = gateway.APIKeyConfig
type Agent ΒΆ
func NewAgent ΒΆ
func NewAgent(cfg *AgentConfig, opts ...AgentOption) *Agent
NewAgent creates a new agent with the given configuration
type AgentConfig ΒΆ
type AgentConfig struct {
Name string
LLM llm.Provider
Output map[string]any
Tools []Tool
Handoffs []*agents.Handoff
McpServers []agents.MCPToolset
MaxLoops *int
History *history.CommonConversationManager
Instruction agents.SystemPromptProvider
Parameters responses.Parameters
StickyHandoff bool
// Skills are folders of instructions the agent reads only when it needs
// them β see NewSkillRegistryFromDir. The agent lists them in its prompt
// and adds the reader tool to Tools itself.
Skills agents.SkillProvider
// Hooks observe or intercept what the agent does. A ToolCallHook wraps
// every tool it calls; a ModelCallHook wraps every call to the model, which
// is where a budget or credit check belongs. One hook may be both.
Hooks []agents.Hook
}
type AgentOption ΒΆ
type AgentOption func(options *agents.AgentOptions)
func WithRuntime ΒΆ
func WithRuntime(runtime agents.Runtime, broker agents.StreamBroker) AgentOption
type AgentRegistry ΒΆ
type AgentRegistry struct {
}
func (*AgentRegistry) Agent ΒΆ
func (_ *AgentRegistry) Agent(name string) (*agents.Agent, bool)
Agent returns a registered agent by name.
func (*AgentRegistry) AgentNames ΒΆ
func (_ *AgentRegistry) AgentNames() []string
AgentNames returns the names of all registered agents, sorted.
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{}
func NewHTTPHandler ΒΆ
func NewHTTPHandler() *HTTPHandler
func (*HTTPHandler) ServeHTTP ΒΆ
func (h *HTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type History ΒΆ
type History = history.CommonConversationManager
func NewFileHistory ΒΆ
func NewFileHistory(path string, opts ...history.ConversationManagerOptions) *History
type Hook ΒΆ
Hook is anything an agent can be given to observe or intercept what it does β see agents.Hook. Implement ToolCallHook, ModelCallHook, or both.
type LLMClient ΒΆ
type LLMClient struct {
// contains filtered or unexported fields
}
func NewLLMClient ΒΆ
func NewLLMClient(configs []ProviderConfig) *LLMClient
type ModelCallHook ΒΆ
type ModelCallHook = agents.ModelCallHook
ModelCallHook wraps a call to the model β see agents.ModelCallHook.
type ModelParameters ΒΆ
type ModelParameters = responses.Parameters
type OutputSchema ΒΆ
type OutputSchema = jsonschema.Schema
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)
func (*RestateRuntime) Start ΒΆ
func (r *RestateRuntime) Start()
type Skill ΒΆ
Skill is one folder of instructions the agent can pull in on demand β see agents.Skill.
type SkillList ΒΆ
SkillList is a SkillProvider for skills the agent can already reach by other means, such as ones staged into its sandbox. It lists them and adds no tool, and says nothing about what they are or how to read them β use SkillsWithHint to say.
type SkillProvider ΒΆ
type SkillProvider = agents.SkillProvider
SkillProvider is where an agent's skills come from. Set one on AgentConfig.Skills and the agent does the rest: it lists the skills in its prompt and adds the provider's reader tool to its own tools.
type SkillRegistry ΒΆ
type SkillRegistry = agents.SkillRegistry
SkillRegistry holds the skills read out of one or more folders β see agents.SkillRegistry. It is a SkillProvider.
type SkillsWithHint ΒΆ
type SkillsWithHint = agents.SkillsWithHint
SkillsWithHint is a SkillProvider for skills your own host serves: it lists them, adds no tool, and introduces them to the model in your words.
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 creates a new Temporal runtime
func (*TemporalRuntime) Start ΒΆ
func (r *TemporalRuntime) Start()
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 ToolCallHook ΒΆ
type ToolCallHook = agents.ToolCallHook
ToolCallHook wraps a tool call β see agents.ToolCallHook.
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 hook 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 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.
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/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
|
|
|
pkg
|
|
|
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. |
|
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. |
|
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. |