Documentation
¶
Index ¶
- func ExposedToolName(canonical string) string
- func NewRuntime(cfg RuntimeConfig, deps RuntimeDeps) (agentkit.ToolRuntime, error)
- func ResultText(result agentkit.ToolResult) string
- type Runtime
- func (r *Runtime) Execute(ctx context.Context, call agentkit.ToolCall) (agentkit.ToolResult, error)
- func (r *Runtime) PreflightTool(ctx context.Context, call agentkit.ToolCall) (agentkit.ToolResult, agentkit.ToolCall, bool, error)
- func (r *Runtime) RunToolBody(ctx context.Context, call agentkit.ToolCall) (agentkit.ToolResult, error)
- func (r *Runtime) StaticToolNames() []string
- func (r *Runtime) Visible(ctx context.Context) ([]agentkit.ToolSpec, error)
- type RuntimeConfig
- type RuntimeDeps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExposedToolName ¶ added in v0.3.34
ExposedToolName makes a plugin tool name safe for OpenAI function / Responses API input names (^ [a-zA-Z0-9_-]+$). Non [A-Za-z0-9_] runes become '_'.
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) PreflightTool ¶ added in v0.3.55
func (r *Runtime) PreflightTool(ctx context.Context, call agentkit.ToolCall) (agentkit.ToolResult, agentkit.ToolCall, bool, error)
PreflightTool runs visibility, policy, approval, and BeforeTool for one call. When runBody is false, result is final (deny, not found, etc.).
func (*Runtime) RunToolBody ¶ added in v0.3.55
func (r *Runtime) RunToolBody(ctx context.Context, call agentkit.ToolCall) (agentkit.ToolResult, error)
RunToolBody executes the tool body and AfterTool. Call only after a successful PreflightTool.
func (*Runtime) StaticToolNames ¶ added in v0.3.27
StaticToolNames returns tool names from deps.tools and deps.toolPacks only (not dynamic providers). tools/deferred uses this to decide which specs stay eager in the model-visible list.
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 (canonical or model-visible; normalized like ExposedToolName).
ToolTimeouts map[string]int `json:"toolTimeouts,omitempty"`
// AllowTools is a model-visible tool name whitelist. When non-empty, only listed tools are exposed (names normalized like ExposedToolName).
AllowTools []string `json:"allowTools,omitempty"`
// DenyTools is a model-visible tool name blacklist. Ignored when AllowTools is set (names normalized like ExposedToolName).
DenyTools []string `json:"denyTools,omitempty"`
}
func (*RuntimeConfig) Validate ¶ added in v0.3.48
func (c *RuntimeConfig) Validate() error
Validate implements pluginkit.Validator.
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"`
}