Documentation
¶
Overview ¶
Package direct provides a gateway that implements ToolGateway by directly delegating to toolindex, tooldocs, and toolrun components. This gateway runs in-process with no isolation boundary.
Index ¶
- Variables
- type Config
- type Gateway
- func (g *Gateway) DescribeTool(ctx context.Context, id string, level tooldoc.DetailLevel) (tooldoc.ToolDoc, error)
- func (g *Gateway) GetToolCalls() []runtime.ToolCallRecord
- func (g *Gateway) ListNamespaces(ctx context.Context) ([]string, error)
- func (g *Gateway) ListToolExamples(ctx context.Context, id string, maxExamples int) ([]tooldoc.ToolExample, error)
- func (g *Gateway) Reset()
- func (g *Gateway) RunChain(ctx context.Context, steps []run.ChainStep) (run.RunResult, []run.StepResult, error)
- func (g *Gateway) RunTool(ctx context.Context, id string, args map[string]any) (run.RunResult, error)
- func (g *Gateway) SearchTools(ctx context.Context, query string, limit int) ([]index.Summary, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrToolCallLimitExceeded is returned when MaxToolCalls is exceeded. ErrToolCallLimitExceeded = errors.New("tool call limit exceeded") // ErrChainStepLimitExceeded is returned when MaxChainSteps is exceeded. ErrChainStepLimitExceeded = errors.New("chain step limit exceeded") )
Errors for limit enforcement
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Index is the tool index for search and lookup.
Index index.Index
// Docs is the documentation store.
Docs tooldoc.Store
// Runner is the tool execution runner.
Runner run.Runner
// MaxToolCalls limits the total number of tool invocations.
// Zero means unlimited.
MaxToolCalls int
// MaxChainSteps limits the number of steps in a chain.
// Zero means unlimited.
MaxChainSteps int
}
Config configures a direct gateway.
type Gateway ¶
type Gateway struct {
// contains filtered or unexported fields
}
Gateway implements ToolGateway by directly delegating to the index, docs, and runner components.
func (*Gateway) DescribeTool ¶
func (g *Gateway) DescribeTool(ctx context.Context, id string, level tooldoc.DetailLevel) (tooldoc.ToolDoc, error)
DescribeTool delegates to the docs store.
func (*Gateway) GetToolCalls ¶
func (g *Gateway) GetToolCalls() []runtime.ToolCallRecord
GetToolCalls returns a copy of all recorded tool calls.
func (*Gateway) ListNamespaces ¶
ListNamespaces delegates to the index.
func (*Gateway) ListToolExamples ¶
func (g *Gateway) ListToolExamples(ctx context.Context, id string, maxExamples int) ([]tooldoc.ToolExample, error)
ListToolExamples delegates to the docs store.
func (*Gateway) Reset ¶
func (g *Gateway) Reset()
Reset clears recorded tool calls and resets the call counter.
func (*Gateway) RunChain ¶
func (g *Gateway) RunChain(ctx context.Context, steps []run.ChainStep) (run.RunResult, []run.StepResult, error)
RunChain delegates to the runner and records the calls.