agents

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentTool

type AgentTool struct {
	// contains filtered or unexported fields
}

AgentTool is the agent tool

func NewAgentTool

func NewAgentTool(config *AgentToolConfig) *AgentTool

NewAgentTool creates a new agent tool

func (*AgentTool) BackfillInput

func (t *AgentTool) BackfillInput(ctx context.Context, input map[string]any) map[string]any

BackfillInput enriches input

func (*AgentTool) Call

func (t *AgentTool) Call(
	ctx context.Context,
	input tool.CallInput,
	permissionCheck types.CanUseToolFn,
) (tool.CallResult, error)

Call executes the tool

func (*AgentTool) CheckPermissions

func (t *AgentTool) CheckPermissions(ctx context.Context, input map[string]any, toolCtx tool.ToolUseContext) types.PermissionResult

CheckPermissions checks permissions

func (*AgentTool) Definition

func (t *AgentTool) Definition() tool.Definition

Definition returns the tool definition

func (*AgentTool) Description

func (t *AgentTool) Description(ctx context.Context) (string, error)

Description returns description

func (*AgentTool) FormatResult

func (t *AgentTool) FormatResult(data any) string

FormatResult formats result

func (*AgentTool) GetRunner

func (t *AgentTool) GetRunner() *coreagent.Runner

GetRunner returns the current runner (if any)

func (*AgentTool) IsConcurrencySafe

func (t *AgentTool) IsConcurrencySafe(input map[string]any) bool

IsConcurrencySafe returns whether tool is concurrency safe

func (*AgentTool) IsEnabled

func (t *AgentTool) IsEnabled() bool

IsEnabled returns whether tool is enabled

func (*AgentTool) IsReadOnly

func (t *AgentTool) IsReadOnly(input map[string]any) bool

IsReadOnly returns whether tool is read-only

func (*AgentTool) SetEngine

func (t *AgentTool) SetEngine(e *engine.Engine)

SetEngine binds this tool instance to a specific engine.

func (*AgentTool) SetRegistry

func (t *AgentTool) SetRegistry(r *coreagent.AgentRegistry)

SetRegistry sets the agent registry for resolving dynamic (skill-based) agent types.

func (*AgentTool) SetRunner

func (t *AgentTool) SetRunner(runner *coreagent.Runner)

SetRunner sets an advanced runner for the agent tool

func (*AgentTool) ValidateInput

func (t *AgentTool) ValidateInput(ctx context.Context, input map[string]any) (map[string]any, error)

ValidateInput validates tool input

type AgentToolConfig

type AgentToolConfig struct {
	Enabled bool
}

Config for Agent tool

func DefaultAgentToolConfig

func DefaultAgentToolConfig() *AgentToolConfig

Default config

type CloseAgentTool

type CloseAgentTool struct {
	// contains filtered or unexported fields
}

CloseAgentTool terminates a sub-agent and removes it from the registry.

func NewCloseAgentTool

func NewCloseAgentTool() *CloseAgentTool

func (*CloseAgentTool) BackfillInput

func (t *CloseAgentTool) BackfillInput(_ context.Context, in map[string]any) map[string]any

func (*CloseAgentTool) Call

func (*CloseAgentTool) CheckPermissions

func (t *CloseAgentTool) CheckPermissions(_ context.Context, in map[string]any, _ tool.ToolUseContext) types.PermissionResult

func (*CloseAgentTool) Definition

func (t *CloseAgentTool) Definition() tool.Definition

func (*CloseAgentTool) Description

func (t *CloseAgentTool) Description(_ context.Context) (string, error)

func (*CloseAgentTool) FormatResult

func (t *CloseAgentTool) FormatResult(data any) string

func (*CloseAgentTool) IsConcurrencySafe

func (t *CloseAgentTool) IsConcurrencySafe(_ map[string]any) bool

func (*CloseAgentTool) IsEnabled

func (t *CloseAgentTool) IsEnabled() bool

func (*CloseAgentTool) IsReadOnly

func (t *CloseAgentTool) IsReadOnly(_ map[string]any) bool

func (*CloseAgentTool) ValidateInput

func (t *CloseAgentTool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error)

type ListAgentsTool

type ListAgentsTool struct {
	// contains filtered or unexported fields
}

ListAgentsTool lists all active sub-agents. Mirrors Codex's CollabAgentTool listing + CollabAgentStatusEntry.

func NewListAgentsTool

func NewListAgentsTool() *ListAgentsTool

func (*ListAgentsTool) BackfillInput

func (t *ListAgentsTool) BackfillInput(_ context.Context, in map[string]any) map[string]any

func (*ListAgentsTool) Call

func (*ListAgentsTool) CheckPermissions

func (t *ListAgentsTool) CheckPermissions(_ context.Context, in map[string]any, _ tool.ToolUseContext) types.PermissionResult

func (*ListAgentsTool) Definition

func (t *ListAgentsTool) Definition() tool.Definition

func (*ListAgentsTool) Description

func (t *ListAgentsTool) Description(_ context.Context) (string, error)

func (*ListAgentsTool) FormatResult

func (t *ListAgentsTool) FormatResult(data any) string

func (*ListAgentsTool) IsConcurrencySafe

func (t *ListAgentsTool) IsConcurrencySafe(_ map[string]any) bool

func (*ListAgentsTool) IsEnabled

func (t *ListAgentsTool) IsEnabled() bool

func (*ListAgentsTool) IsReadOnly

func (t *ListAgentsTool) IsReadOnly(_ map[string]any) bool

func (*ListAgentsTool) ValidateInput

func (t *ListAgentsTool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error)

type ResumeAgentTool

type ResumeAgentTool struct {
	// contains filtered or unexported fields
}

ResumeAgentTool resumes a persisted sub-agent session with a new task.

func NewResumeAgentTool

func NewResumeAgentTool(eng *engine.Engine, tools []tool.Tool, reg *coreagent.AgentRegistry) *ResumeAgentTool

func (*ResumeAgentTool) BackfillInput

func (t *ResumeAgentTool) BackfillInput(_ context.Context, in map[string]any) map[string]any

func (*ResumeAgentTool) Call

func (*ResumeAgentTool) CheckPermissions

func (*ResumeAgentTool) Definition

func (t *ResumeAgentTool) Definition() tool.Definition

func (*ResumeAgentTool) Description

func (t *ResumeAgentTool) Description(_ context.Context) (string, error)

func (*ResumeAgentTool) FormatResult

func (t *ResumeAgentTool) FormatResult(data any) string

func (*ResumeAgentTool) IsConcurrencySafe

func (t *ResumeAgentTool) IsConcurrencySafe(_ map[string]any) bool

func (*ResumeAgentTool) IsEnabled

func (t *ResumeAgentTool) IsEnabled() bool

func (*ResumeAgentTool) IsReadOnly

func (t *ResumeAgentTool) IsReadOnly(_ map[string]any) bool

func (*ResumeAgentTool) ValidateInput

func (t *ResumeAgentTool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error)

type SendAgentMessageTool

type SendAgentMessageTool struct {
	// contains filtered or unexported fields
}

SendAgentMessageTool sends a message to a running agent's continuation queue.

func NewSendAgentMessageTool

func NewSendAgentMessageTool() *SendAgentMessageTool

func (*SendAgentMessageTool) BackfillInput

func (t *SendAgentMessageTool) BackfillInput(_ context.Context, in map[string]any) map[string]any

func (*SendAgentMessageTool) Call

func (*SendAgentMessageTool) CheckPermissions

func (*SendAgentMessageTool) Definition

func (t *SendAgentMessageTool) Definition() tool.Definition

func (*SendAgentMessageTool) Description

func (t *SendAgentMessageTool) Description(_ context.Context) (string, error)

func (*SendAgentMessageTool) FormatResult

func (t *SendAgentMessageTool) FormatResult(data any) string

func (*SendAgentMessageTool) IsConcurrencySafe

func (t *SendAgentMessageTool) IsConcurrencySafe(_ map[string]any) bool

func (*SendAgentMessageTool) IsEnabled

func (t *SendAgentMessageTool) IsEnabled() bool

func (*SendAgentMessageTool) IsReadOnly

func (t *SendAgentMessageTool) IsReadOnly(_ map[string]any) bool

func (*SendAgentMessageTool) ValidateInput

func (t *SendAgentMessageTool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error)

type SkillForkRunner

type SkillForkRunner struct {
	// contains filtered or unexported fields
}

SkillForkRunner implements skills.ForkRunner: it runs a `context: fork` skill's rendered prompt as an isolated sub-agent, reusing the same spawn-depth guard, wall-clock timeout, and permission-mode inheritance policy (subAgentPermissionMode) every other sub-agent path in this package already uses, rather than inventing a second, divergent execution policy for skills specifically.

func NewSkillForkRunner

func NewSkillForkRunner(eng *engine.Engine) *SkillForkRunner

NewSkillForkRunner builds a SkillForkRunner bound to eng. Wire the result into the registered skill tool via SkillTool.SetForkRunner once eng exists (the tool itself is constructed and registered before the engine is, so this is a post-construction injection - see pkg/sdk/client.go).

func (*SkillForkRunner) RunForkedSkill

func (r *SkillForkRunner) RunForkedSkill(ctx context.Context, skillName, task string, allowedTools []string, model string, parentPermissionMode types.PermissionMode) (string, error)

RunForkedSkill runs task (the skill's already-rendered prompt, arguments already substituted) as a sub-agent scoped to allowedTools and model - both straight from the skill's own frontmatter (AllowedTools/Model), which have no effect on the default, non-forked execution path. Returns the sub-agent's final text output.

type SpawnAgentTool

type SpawnAgentTool struct {
	// contains filtered or unexported fields
}

SpawnAgentTool launches a sub-agent asynchronously and returns immediately. Mirrors Codex's CollabAgentTool = "spawnAgent" + CollabAgentSpawnBeginEvent / CollabAgentSpawnEndEvent.

func NewSpawnAgentTool

func NewSpawnAgentTool(eng *engine.Engine, tools []tool.Tool, reg *coreagent.AgentRegistry) *SpawnAgentTool

func (*SpawnAgentTool) BackfillInput

func (t *SpawnAgentTool) BackfillInput(_ context.Context, in map[string]any) map[string]any

func (*SpawnAgentTool) Call

func (*SpawnAgentTool) CheckPermissions

func (t *SpawnAgentTool) CheckPermissions(_ context.Context, in map[string]any, _ tool.ToolUseContext) types.PermissionResult

func (*SpawnAgentTool) Definition

func (t *SpawnAgentTool) Definition() tool.Definition

func (*SpawnAgentTool) Description

func (t *SpawnAgentTool) Description(_ context.Context) (string, error)

func (*SpawnAgentTool) FormatResult

func (t *SpawnAgentTool) FormatResult(data any) string

func (*SpawnAgentTool) IsConcurrencySafe

func (t *SpawnAgentTool) IsConcurrencySafe(_ map[string]any) bool

func (*SpawnAgentTool) IsEnabled

func (t *SpawnAgentTool) IsEnabled() bool

func (*SpawnAgentTool) IsReadOnly

func (t *SpawnAgentTool) IsReadOnly(_ map[string]any) bool

func (*SpawnAgentTool) ValidateInput

func (t *SpawnAgentTool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error)

type WaitAgentTool

type WaitAgentTool struct {
	// contains filtered or unexported fields
}

WaitAgentTool blocks until an agent finishes and returns its result.

func NewWaitAgentTool

func NewWaitAgentTool() *WaitAgentTool

func (*WaitAgentTool) BackfillInput

func (t *WaitAgentTool) BackfillInput(_ context.Context, in map[string]any) map[string]any

func (*WaitAgentTool) Call

func (*WaitAgentTool) CheckPermissions

func (t *WaitAgentTool) CheckPermissions(_ context.Context, in map[string]any, _ tool.ToolUseContext) types.PermissionResult

func (*WaitAgentTool) Definition

func (t *WaitAgentTool) Definition() tool.Definition

func (*WaitAgentTool) Description

func (t *WaitAgentTool) Description(_ context.Context) (string, error)

func (*WaitAgentTool) FormatResult

func (t *WaitAgentTool) FormatResult(data any) string

func (*WaitAgentTool) IsConcurrencySafe

func (t *WaitAgentTool) IsConcurrencySafe(_ map[string]any) bool

func (*WaitAgentTool) IsEnabled

func (t *WaitAgentTool) IsEnabled() bool

func (*WaitAgentTool) IsReadOnly

func (t *WaitAgentTool) IsReadOnly(_ map[string]any) bool

func (*WaitAgentTool) ValidateInput

func (t *WaitAgentTool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error)

Jump to

Keyboard shortcuts

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