Help us shape the future of Go! Take the 2026 Go Developer Survey

tools

package
v0.3.13 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRuntime

func NewRuntime(cfg RuntimeConfig, deps RuntimeDeps) (agentkit.ToolRuntime, error)

NewRuntime registers tools/runtime: Tool orchestration: visibility, policy evaluation, hooks, execution, result capping.

Best practices:

  • Policies are the enforcement plane; hooks only observe and rewrite. Put a security rule in a policy.
  • The approval dep is consulted only for ask decisions, so it never sees an allowed or denied call.

func ResultText

func ResultText(result agentkit.ToolResult) string

Types

type Runtime

type Runtime struct {
	// contains filtered or unexported fields
}

Runtime executes tools through the policy and approval pipeline.

func (*Runtime) Execute

func (r *Runtime) Execute(ctx context.Context, call agentkit.ToolCall) (agentkit.ToolResult, error)

func (*Runtime) Visible

func (r *Runtime) Visible(ctx context.Context) ([]agentkit.ToolSpec, error)

type RuntimeConfig

type RuntimeConfig struct {
	// DefaultTimeoutSeconds is per-call timeout when a tool has no specific entry.
	DefaultTimeoutSeconds int `json:"defaultTimeoutSeconds"`
	// MaxResultBytes is deprecated and ignored; spill/truncation happens in session.PrepareToolResultForStorage.
	MaxResultBytes int `json:"maxResultBytes"`
	// ToolTimeouts are per-tool timeout overrides, keyed by tool name.
	ToolTimeouts map[string]int `json:"toolTimeouts,omitempty"`
	// AllowTools is a model-visible tool name whitelist. When non-empty, only listed tools are exposed.
	AllowTools []string `json:"allowTools,omitempty"`
	// DenyTools is a model-visible tool name blacklist. Ignored when AllowTools is set.
	DenyTools []string `json:"denyTools,omitempty"`
}

type RuntimeDeps

type RuntimeDeps struct {
	Tools        []agentkit.Tool         `json:"tools,omitempty"`
	ToolPacks    []agentkit.ToolPack     `json:"toolPacks,omitempty"`
	DynamicTools []agentkit.ToolProvider `json:"dynamicTools,omitempty"`
	Policies     []agentkit.Policy       `json:"policies,omitempty"`
	Approval     agentkit.Approval       `json:"approval,omitempty"`
	Hooks        agentkit.HookRuntime    `json:"hooks,omitempty"`
}

Jump to

Keyboard shortcuts

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