tool

package
v1.0.0-alpha.11 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildJobTools

func BuildJobTools() []fantasy.AgentTool

BuildJobTools returns the three async-job tools when a daemon callback path is wired (OTTERSD_URL + OTTERS_AGENT_TOKEN both set in the spawn env). Returns an empty slice when env vars are missing — caller appends to LoadTools' result so absence just means the agent doesn't see those tools, not a hard failure.

One *jobsclient.Client is shared across all three tools — the underlying gRPC connection multiplexes RPCs and lazy-dials on first use, so an agent that never invokes a job tool pays nothing.

func LoadTools

func LoadTools(defs []Def, workDir string, logger *zap.Logger) ([]fantasy.AgentTool, error)

Types

type Def

type Def struct {
	Name        string
	Description string
	Binary      string
	Args        []string
	Doc         string
}

type Input

type Input struct {
	Args  []string `` /* 138-byte string literal not displayed */
	Stdin string   `` /* 174-byte string literal not displayed */
}

Input is the BIN tool call shape exposed to the LLM. Fantasy reflects this struct into a JSON schema, so the model sees `args` and `stdin` as named fields and picks whichever the tool needs.

Both fields are optional. Tools that take only argv use `args` and ignore `stdin`; tools whose meaningful input flows over stdin (`yaegi run -`, `pandoc`, `markitdown`, …) use `stdin` (often alongside a small `args` like `["run", "-"]`). At least one of them is required — empty calls are rejected so the model gets immediate feedback rather than the binary's own help text.

type JobIDInput

type JobIDInput struct {
	JobID string `json:"job_id" jsonschema:"description=Job id returned by job_submit"`
}

JobIDInput is the shared schema for status / wait / cancel — they all take just a job id.

type SubmitJobInput

type SubmitJobInput struct {
	Bin    string            `json:"bin" jsonschema:"description=BIN name as declared in this agent's Agentfile (sh, jq, kubectl, …)"`
	Args   []string          `json:"args,omitempty" jsonschema:"description=Positional arguments forwarded to the BIN"`
	Stdin  string            `json:"stdin,omitempty" jsonschema:"description=Optional stdin payload piped to the BIN"`
	Labels map[string]string `` /* 141-byte string literal not displayed */
}

SubmitJobInput is the model-facing schema for `job_submit`. The jsonschema tags drive what the model sees in its tool-list prompt — keep them tight so the model isn't tempted to pass irrelevant fields.

Jump to

Keyboard shortcuts

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