Documentation
¶
Overview ¶
Package shell provides an eino shell tool backed by the Dagger engine. It gives LLM agents a secure, sandboxed shell inside an OCI base image (golang, node, python, etc.) with shared caching across agents.
The tool implements both tool.InvokableTool and tool.StreamableTool.
Index ¶
- func Check(ctx context.Context, cfg *Config) checkup.Results
- func NewAllToolsWithSafety(ctx context.Context, cfg *Config, safetyCfg *safetymw.Config) ([]tool.InvokableTool, *safetymw.Middleware, error)
- func NewShellToolsForProfiles(ctx context.Context, cfg *Config) (map[string]*ShellTool, error)
- func WriteToolNames() []string
- type Config
- type ShellParams
- type ShellTool
- func (t *ShellTool) Info(ctx context.Context) (*schema.ToolInfo, error)
- func (t *ShellTool) InvokableRun(ctx context.Context, args string, opts ...tool.Option) (string, error)
- func (t *ShellTool) Invoke(ctx context.Context, params *ShellParams) (string, error)
- func (t *ShellTool) InvokeAsStream(ctx context.Context, params *ShellParams) (*schema.StreamReader[string], error)
- func (t *ShellTool) StreamableRun(ctx context.Context, args string, opts ...tool.Option) (*schema.StreamReader[string], error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAllToolsWithSafety ¶
func NewAllToolsWithSafety(ctx context.Context, cfg *Config, safetyCfg *safetymw.Config) ([]tool.InvokableTool, *safetymw.Middleware, error)
func WriteToolNames ¶
func WriteToolNames() []string
Types ¶
type Config ¶
type Config struct {
BaseImage string `validate:"omitempty" jsonschema:"description=Default OCI base image when no profile matches"`
Profiles map[string]profile.Profile `validate:"omitempty" jsonschema:"description=Profile overrides keyed by profile name"`
Workdir string `validate:"required" jsonschema:"description=Project workdir to mount into containers"`
NetworkPolicy *egress.Policy `validate:"omitempty" jsonschema:"description=Egress network policy for container outbound access"`
CacheKey string `validate:"omitempty" jsonschema:"description=Cache volume key prefix for shared installs"`
RegistryAuth map[string]dagger.RegistryAuth `validate:"omitempty" jsonschema:"description=Registry auth credentials keyed by hostname"`
Blocklist []string `validate:"omitempty" jsonschema:"description=Custom command blocklist patterns (extend defaults)"`
DefaultTimeout time.Duration `validate:"omitempty" jsonschema:"description=Default timeout for command execution"`
}
type ShellParams ¶
type ShellParams struct {
Command []string `json:"command" validate:"required,min=1" jsonschema:"(required) The command to execute as an array of strings"`
Profile string `json:"profile,omitempty" validate:"omitempty" jsonschema:"(optional) Profile name to override default container image"`
DryRun bool `json:"dryRun,omitempty" jsonschema:"(optional) If true, preview the command without executing"`
Confirmed bool `json:"confirmed,omitempty" jsonschema:"(optional) Must be true to actually execute"`
FilterPattern string `json:"filterPattern,omitempty" validate:"omitempty" jsonschema:"(optional) A Go RE2 regex applied on each output line"`
Timeout string `json:"timeout,omitempty" validate:"omitempty" jsonschema:"(optional) Timeout duration string (e.g. '30s', '5m')"`
AllowLocalNetwork *bool `json:"allowLocalNetwork,omitempty" jsonschema:"(optional) Override to allow local network access for this call"`
}
type ShellTool ¶
type ShellTool struct {
// contains filtered or unexported fields
}
func (*ShellTool) InvokableRun ¶
func (*ShellTool) InvokeAsStream ¶
func (t *ShellTool) InvokeAsStream(ctx context.Context, params *ShellParams) (*schema.StreamReader[string], error)
Click to show internal directories.
Click to hide internal directories.