toolworker

package
v1.5.170 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package toolworker runs file tools in a fresh, per-call OS sandbox. The process running the agent is never sandboxed: credentials, model connections, history and the rewind journal stay in the parent. Only approved tool input, the workspace and the grant snapshot cross the process boundary.

Index

Constants

View Source
const Flag = "--tool-worker"

Variables

This section is empty.

Functions

func Serve

func Serve(ctx context.Context, in io.Reader, out io.Writer) error

Serve runs in the worker subprocess, exclusively. It consumes one request, creates a grant table in memory, executes a known file tool, then exits. The parent already passed the call through its three gates; these checks are a second layer, not a substitute for the parent gate or the OS sandbox.

Types

type Request

type Request struct {
	Name       string          `json:"name"`
	ID         string          `json:"id"`
	Args       json.RawMessage `json:"args"`
	Root       string          `json:"root"`
	ExtraRoots []string        `json:"extraRoots,omitempty"`
	Grants     grants.Entries  `json:"-"`
	Rows       []grantWire     `json:"grants"`
	ReadFile   string          `json:"readFile,omitempty"`
	WriteFile  string          `json:"writeFile,omitempty"`
}

Request carries one approved call. No credential or persistent state path is transferred; the worker never opens grants.json. Exact grants are copied from the call context after the boundary gate has answered.

type Tool

type Tool struct {
	Original   agentcore.AgentTool
	Root       string
	ExtraRoots []string
	Snap       *agenttool.FileSnapshotRecorder
	Runner     seatbelt.CallRunner
	Mode       *permissions.State
	// RequireIsolation, when set, refuses a call whose OS runner is missing
	// instead of running the native tool in-process. Production sets it where
	// isolation is the default; on a platform with no sandbox implementation it
	// stays false so the tools keep working as they always did.
	RequireIsolation bool
	// Binary overrides the current executable (integration tests only).
	Binary string
}

Tool decorates a built-in file tool without changing its public schema, scheduling mode or identity. Only builtin file tools are decorated; shell, network, session and in-memory tools use their own execution routes.

func (*Tool) Description

func (t *Tool) Description() string

func (*Tool) Execute

func (*Tool) ExecutionMode

func (t *Tool) ExecutionMode() agentcore.ToolExecutionMode

func (*Tool) Name

func (t *Tool) Name() string

func (*Tool) Schema

func (t *Tool) Schema() json.RawMessage

Jump to

Keyboard shortcuts

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