Documentation
¶
Overview ¶
Package sandboxtools exposes the thread sandbox to the model: execute_command (with background jobs: job_output, job_kill), read_file (text, documents, images), view_file (rendered pages), search_files, write_file, edit_file and list_files.
Index ¶
Constants ¶
const NoVisionError = "this model cannot view images; use read_file and the skill's inspect script"
NoVisionError is the view_file error for models that cannot see images.
const RecreatedNotice = "Notice: the sandbox stopped or stayed unresponsive and has been recreated; /workspace was reset and previous files are gone."
RecreatedNotice tells the model its previous sandbox was replaced.
const RemovedJobNote = "" /* 242-byte string literal not displayed */
RemovedJobNote is the stderr of a command that deleted its own job directory (%s: the directory, %d: the exit code). Round 3, A11.
const StaleFileError = "file changed since you last read it; read it again"
StaleFileError is the edit_file error for a file changed since the model last saw it.
Variables ¶
This section is empty.
Functions ¶
func ExtractText ¶
ExtractText returns up to maxChars characters of a file's text: documents through the extraction script (markitdown, pdftotext), text files as they are; images and other binaries give "" (the goal judge's deliverable excerpt).
Types ¶
type Options ¶
type Options struct {
// CommandTimeout is the default execute_command timeout (default 120 s).
CommandTimeout time.Duration
// MaxSandboxesPerUser is only used in the quota error message.
MaxSandboxesPerUser int
// OnAcquire runs after every successful sandbox acquisition (installs the skills the run needs).
OnAcquire func(ctx context.Context, rc tools.RunContext, sb sandbox.Sandbox)
// BeforeCommand runs before every execute_command command (foreground or
// background job) starts, e.g. to install the skills it names
// (/skills/<name>/). A sandbox found gone fails the call (retried on a new
// sandbox); other errors are logged and the command runs.
BeforeCommand func(ctx context.Context, rc tools.RunContext, sb sandbox.Sandbox, command string) error
// OnWrite runs after write_file or edit_file wrote content to path (e.g.
// to install the skills the content names); its errors are logged.
OnWrite func(ctx context.Context, rc tools.RunContext, sb sandbox.Sandbox, path string, content []byte) error
// CheckWrite runs after write_file or edit_file wrote path; a non-empty result
// (a syntax error, say) is added to the tool result as its notice.
CheckWrite func(ctx context.Context, sb sandbox.Sandbox, path string) string
// AfterPath runs after read_file, write_file or edit_file succeeded on path (an absolute sandbox path); a
// non-empty result is appended to the tool result (the notes of the directory the file is in).
// It runs at most once per call and must be cheap when it has nothing to say.
AfterPath func(ctx context.Context, rc tools.RunContext, sb sandbox.Sandbox, path string) string
// AfterFailedCommand runs after a foreground command exited non-zero,
// with its output (stdout then stderr); a non-empty result is added to the
// tool result as its note (e.g. "Skill x was installed; run the command
// again."). The command is never re-run.
AfterFailedCommand func(ctx context.Context, rc tools.RunContext, sb sandbox.Sandbox, output string) string
// KeepAlive renews the sandbox of a running background job until stop
// (jobs.go; default sandbox.KeepAlive).
KeepAlive func(ctx context.Context, sb sandbox.Sandbox) (stop func())
// JobPollEvery is how often a kept-alive job's status is checked (default 60 s);
// JobKeepAliveMax bounds the keep-alive of one job (default 6 h).
JobPollEvery time.Duration
JobKeepAliveMax time.Duration
// Jobs persists the running background jobs (nil: in memory only, their
// keep-alives end with the process).
Jobs JobList
// Coding describes the tools for a coding agent (AGENT_PROFILE=coding): no
// document features in read_file, execute_command and the like (coding.go).
Coding bool
}
Options configures the provider.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider is the sandbox tools provider.
func (*Provider) KeepResumingJobs ¶
func (p *Provider) KeepResumingJobs(ctx context.Context, every time.Duration, done func(resumed int))
KeepResumingJobs runs ResumeJobs now and then every `every` until ctx ends: a job whose owner died (its lease expired) is taken over by a live replica.
func (*Provider) ResumeJobs ¶
ResumeJobs re-registers the keep-alive of every listed job still running in its thread's live sandbox that no other process keeps alive (a runtime process start, then periodically: KeepResumingJobs), for what is left of its budget; jobs past their budget, finished or without a sandbox are dropped from the list. It creates no sandbox.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package conformance checks that a sandbox adapter runs the harness' sandbox tools (execute_command with background jobs, read/write/edit/list files, search_files) end to end: the scripts those tools send through sandbox.Sandbox.Exec need bash, GNU coreutils, python3 and ripgrep in the sandbox image (docs/sandbox-adapters.md).
|
Package conformance checks that a sandbox adapter runs the harness' sandbox tools (execute_command with background jobs, read/write/edit/list files, search_files) end to end: the scripts those tools send through sandbox.Sandbox.Exec need bash, GNU coreutils, python3 and ripgrep in the sandbox image (docs/sandbox-adapters.md). |