wire

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

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 ToAgentTools

func ToAgentTools(typed []TypedTool, raw []loop.AgentTool, holder *RunScopeHolder) []loop.AgentTool

ToAgentTools converts typed and raw tools into loop.AgentTool values.

Types

type RunScope

type RunScope struct {
	Ctx   context.Context
	Local any
}

RunScope holds per-run context passed to tool handlers.

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.

func (*RunScopeHolder) Set

func (h *RunScopeHolder) Set(ctx context.Context, local any)

Set activates a run scope for the current Session.Run call.

type Settings

type Settings struct {
	Temperature *float64
	MaxTokens   *int
}

Settings holds optional generation parameters applied at the gateway boundary.

type TypedTool

type TypedTool struct {
	Name        string
	Description string
	Parameters  any
	Handler     func(holder *RunScopeHolder, callID string, params map[string]any) (string, error)
}

TypedTool is a tool definition with a handler that receives the active run scope.

Jump to

Keyboard shortcuts

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