Documentation
¶
Index ¶
- Constants
- func NewToolSet() tools.ToolSet
- type Handler
- func (h *Handler) HandleList(_ context.Context, _ *session.Session, _ tools.ToolCall) (*tools.ToolCallResult, error)
- func (h *Handler) HandleRun(ctx context.Context, sess *session.Session, toolCall tools.ToolCall) (*tools.ToolCallResult, error)
- func (h *Handler) HandleStop(_ context.Context, _ *session.Session, toolCall tools.ToolCall) (*tools.ToolCallResult, error)
- func (h *Handler) HandleView(_ context.Context, _ *session.Session, toolCall tools.ToolCall) (*tools.ToolCallResult, error)
- func (h *Handler) RegisterHandlers(register func(name string, ...))
- func (h *Handler) StopAll()
- type RunBackgroundAgentArgs
- type RunParams
- type RunResult
- type Runner
- type StopBackgroundAgentArgs
- type ViewBackgroundAgentArgs
Constants ¶
const ( ToolNameRunBackgroundAgent = "run_background_agent" ToolNameListBackgroundAgents = "list_background_agents" ToolNameViewBackgroundAgent = "view_background_agent" ToolNameStopBackgroundAgent = "stop_background_agent" )
Variables ¶
This section is empty.
Functions ¶
func NewToolSet ¶
NewToolSet returns a lightweight ToolSet for registering background agent tool definitions and instructions. It does not require a Runner and is suitable for use in the teamloader registry.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler owns all background agent tasks and provides tool handlers.
func NewHandler ¶
NewHandler creates a new Handler with the given Runner.
func (*Handler) HandleList ¶
func (h *Handler) HandleList(_ context.Context, _ *session.Session, _ tools.ToolCall) (*tools.ToolCallResult, error)
HandleList lists all background agent tasks.
func (*Handler) HandleRun ¶
func (h *Handler) HandleRun(ctx context.Context, sess *session.Session, toolCall tools.ToolCall) (*tools.ToolCallResult, error)
HandleRun starts a sub-agent task asynchronously and returns a task ID immediately.
func (*Handler) HandleStop ¶
func (h *Handler) HandleStop(_ context.Context, _ *session.Session, toolCall tools.ToolCall) (*tools.ToolCallResult, error)
HandleStop cancels a running background agent task.
func (*Handler) HandleView ¶
func (h *Handler) HandleView(_ context.Context, _ *session.Session, toolCall tools.ToolCall) (*tools.ToolCallResult, error)
HandleView returns the output and status of a specific background agent task.
func (*Handler) RegisterHandlers ¶ added in v1.30.1
func (h *Handler) RegisterHandlers(register func(name string, fn func(context.Context, *session.Session, tools.ToolCall) (*tools.ToolCallResult, error)))
RegisterHandlers adds all background agent tool handlers to the given dispatch map, keyed by tool name.
type RunBackgroundAgentArgs ¶
type RunBackgroundAgentArgs struct {
Agent string `json:"agent" jsonschema:"The name of the sub-agent to run in the background."`
Task string `json:"task" jsonschema:"A clear and concise description of the task the agent should achieve."`
ExpectedOutput string `json:"expected_output,omitempty" jsonschema:"The expected output from the agent (optional)."`
}
RunBackgroundAgentArgs specifies the parameters for dispatching a sub-agent task asynchronously.
type RunParams ¶
type RunParams struct {
AgentName string
Task string
ExpectedOutput string
ParentSession *session.Session
OnContent func(content string)
}
RunParams holds the parameters for running a sub-agent.
type RunResult ¶
type RunResult struct {
Result string // final assistant message on completion
ErrMsg string // error detail if failed
}
RunResult holds the outcome of a sub-agent execution.
type Runner ¶
type Runner interface {
// CurrentAgentSubAgentNames returns the names of the current agent's sub-agents.
CurrentAgentSubAgentNames() []string
// RunAgent starts a sub-agent and blocks until completion or cancellation.
RunAgent(ctx context.Context, params RunParams) *RunResult
}
Runner abstracts the runtime dependency for background agent execution.
type StopBackgroundAgentArgs ¶
type StopBackgroundAgentArgs struct {
TaskID string `json:"task_id" jsonschema:"The ID of the background agent task to stop."`
}
StopBackgroundAgentArgs specifies the task ID to cancel.
type ViewBackgroundAgentArgs ¶
type ViewBackgroundAgentArgs struct {
TaskID string `json:"task_id" jsonschema:"The ID of the background agent task to view."`
}
ViewBackgroundAgentArgs specifies the task ID to inspect.