Documentation
¶
Index ¶
- func NewAgent(gw *gateway.LLMGateway, model protocol.ModelDescriptor, instructions string, ...) *agent.Agent
- func NewStreamFn(gw *gateway.LLMGateway, settings Settings) loop.StreamFn
- func RunCtx(holder *RunScopeHolder) context.Context
- func RunWithHooks(holder *RunScopeHolder, toolName, callID string, params map[string]any, ...) (string, error)
- func ToAgentTools(typed []TypedTool, holder *RunScopeHolder) []loop.AgentTool
- type HookSet
- type RunScope
- type RunScopeHolder
- type Settings
- type TypedTool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAgent ¶
func NewAgent(gw *gateway.LLMGateway, model protocol.ModelDescriptor, instructions string, settings Settings, tools []loop.AgentTool) *agent.Agent
NewAgent builds a pith agent wired to the given gateway, model, and tools.
func NewStreamFn ¶
func NewStreamFn(gw *gateway.LLMGateway, settings Settings) loop.StreamFn
NewStreamFn returns a StreamFn that delegates to the gateway and merges settings.
func RunCtx ¶ added in v0.2.0
func RunCtx(holder *RunScopeHolder) context.Context
RunCtx returns the active run context from holder, or context.Background().
func RunWithHooks ¶ added in v0.2.0
func RunWithHooks(holder *RunScopeHolder, toolName, callID string, params map[string]any, run func() (string, error)) (string, error)
RunWithHooks runs BeforeToolCall, invoke, and AfterToolCall for a tool handler.
func ToAgentTools ¶
func ToAgentTools(typed []TypedTool, holder *RunScopeHolder) []loop.AgentTool
ToAgentTools converts typed tools into loop.AgentTool values.
Types ¶
type HookSet ¶ added in v0.2.0
type HookSet struct {
BeforeToolCall func(sessionID, runID, toolName, callID string, args map[string]any) (block bool, reason string, err error)
AfterToolCall func(sessionID, runID, toolName, callID string, args map[string]any, result string, resultErr error) (override string, err error)
}
HookSet holds SDK-level hooks for tool call lifecycle.
type RunScopeHolder ¶
type RunScopeHolder struct {
// contains filtered or unexported fields
}
RunScopeHolder stores the active run scope for tool execution.
func NewRunScopeHolder ¶
func NewRunScopeHolder() *RunScopeHolder
NewRunScopeHolder creates a holder for per-run tool context.
func (*RunScopeHolder) Clear ¶
func (h *RunScopeHolder) Clear()
Clear removes the active run scope after a run completes.
func (*RunScopeHolder) Current ¶
func (h *RunScopeHolder) Current() *RunScope
Current returns the active run scope, or nil if none is set.