Documentation
¶
Index ¶
- Constants
- func BuildSkillSystemMessage(prepared *PreparedSkillFork, attachedFiles []string) string
- func BuildSkillUserMessage(prepared *PreparedSkillFork) string
- type PreparedSkillFork
- type RunSkillArgs
- type ToolSet
- func (s *ToolSet) FindSkill(name string) *skills.Skill
- func (s *ToolSet) Instructions() string
- func (s *ToolSet) PrepareForkSubSession(ctx context.Context, args RunSkillArgs) (*PreparedSkillFork, *tools.ToolCallResult)
- func (s *ToolSet) ReadSkillContent(ctx context.Context, name string) (string, error)
- func (s *ToolSet) ReadSkillFile(skillName, relativePath string) (string, error)
- func (s *ToolSet) Skills() []skills.Skill
- func (s *ToolSet) Tools(context.Context) ([]tools.Tool, error)
Constants ¶
const ( ToolNameReadSkill = "read_skill" ToolNameReadSkillFile = "read_skill_file" ToolNameRunSkill = "run_skill" )
Variables ¶
This section is empty.
Functions ¶
func BuildSkillSystemMessage ¶ added in v1.62.0
func BuildSkillSystemMessage(prepared *PreparedSkillFork, attachedFiles []string) string
BuildSkillSystemMessage returns the system prompt of a forked skill sub-session. It avoids the task-delegation boilerplate from buildTaskSystemMessage (which references <task> / "team of agents") since skills aren't delegations. attachedFiles, when non-empty, exposes parent-attached files by absolute path.
func BuildSkillUserMessage ¶ added in v1.62.0
func BuildSkillUserMessage(prepared *PreparedSkillFork) string
BuildSkillUserMessage formats a PreparedSkillFork as the implicit user message of a forked sub-session. It mirrors the inline `<skill name=...>` envelope used by ResolveSkillCommand for non-fork skills, strips the YAML frontmatter (already consumed by the runtime), and surfaces a non-empty Task as a "User's request:" header.
Types ¶
type PreparedSkillFork ¶
type PreparedSkillFork struct {
// SkillName is the validated skill name, suitable for span attributes,
// log fields, and sub-session titles ("Skill: <name>").
SkillName string
// Task is the caller-supplied task description, intended to be used as
// the implicit user message of the child session.
Task string
// Content is the expanded SKILL.md content. Wrap with
// BuildSkillUserMessage to use as the child's first user message.
Content string
// Model is the optional model override declared in the SKILL.md
// frontmatter. Empty means "use the parent agent's current model".
Model string
}
PreparedSkillFork carries the validated and expanded data needed to launch a skill as an isolated sub-agent. Callers (typically the runtime) use it to build the child session; this lets the skill-specific business rules (lookup, fork validation, content expansion) live with the toolset rather than the runtime.
type RunSkillArgs ¶
type RunSkillArgs struct {
Name string `json:"name" jsonschema:"The name of the skill to run in a forked context"`
Task string `json:"task" jsonschema:"A clear description of the task the skill should achieve"`
}
RunSkillArgs specifies the parameters for the run_skill tool.
type ToolSet ¶ added in v1.60.0
type ToolSet struct {
// contains filtered or unexported fields
}
ToolSet provides the read_skill and read_skill_file tools that let an agent load skill content and supporting resources by name. It hides whether a skill is local or remote — the agent just sees a name and description.
func (*ToolSet) FindSkill ¶ added in v1.60.0
FindSkill returns the skill with the given name, or nil if not found.
func (*ToolSet) Instructions ¶ added in v1.60.0
func (*ToolSet) PrepareForkSubSession ¶ added in v1.60.0
func (s *ToolSet) PrepareForkSubSession(ctx context.Context, args RunSkillArgs) (*PreparedSkillFork, *tools.ToolCallResult)
PrepareForkSubSession validates a run_skill request and loads the expanded skill content. It returns either a populated PreparedSkillFork, or a ToolCallResult describing why the call cannot proceed (skill missing, skill not configured for fork mode, content read failure). The caller is responsible for the runtime-specific orchestration (sub-session creation, tracing, event forwarding).
func (*ToolSet) ReadSkillContent ¶ added in v1.60.0
ReadSkillContent returns the content of a skill's SKILL.md by name. For local skills, it expands any !`command` patterns in the content by executing the commands and replacing the patterns with their stdout output. Command expansion is disabled for remote skills to prevent arbitrary code execution.
func (*ToolSet) ReadSkillFile ¶ added in v1.60.0
ReadSkillFile returns the content of a supporting file within a skill. The path is relative to the skill's base directory (e.g. "references/FORMS.md").