Documentation
¶
Index ¶
- type CloneableToolProvider
- type FileToolProvider
- type PensieveToolProvider
- type Registry
- func (r *Registry) AllTools(ctx context.Context) Tools
- func (r *Registry) CloneWithEphemeralProviders() *Registry
- func (r *Registry) Exclude(names ...string) *Registry
- func (r *Registry) FilterDenied(ctx context.Context, cfg hitl.Config) *Registry
- func (r *Registry) GetTool(ctx context.Context, name string) (tool.Tool, error)
- func (r *Registry) GetToolDescriptions(ctx context.Context) []string
- func (r *Registry) GetTools(ctx context.Context) []tool.Tool
- func (r *Registry) Include(names ...string) *Registry
- func (r *Registry) ToolNames(ctx context.Context) []string
- func (r *Registry) UnavailableNames(ctx context.Context, names []string) []string
- type ShellToolProvider
- type SkillLoadConfig
- type SkillToolProvider
- func (p *SkillToolProvider) Clone() ToolProviders
- func (p *SkillToolProvider) Get(name string) (dynamicskills.Skill, bool)
- func (p *SkillToolProvider) GetTools(_ context.Context) []tool.Tool
- func (p *SkillToolProvider) MutableRepo() *skills.MutableRepository
- func (p *SkillToolProvider) Search(query string) []dynamicskills.Skill
- type SmartToolProvider
- type ToolProviders
- type ToolSearchResult
- type ToolSearchResults
- type Tools
- type VectorToolProvider
- func (v *VectorToolProvider) GetSearchTool() tool.Tool
- func (v *VectorToolProvider) RecordToolUsage(ctx context.Context, toolNames []string)
- func (v *VectorToolProvider) SearchTools(ctx context.Context, query string, limit int) (ToolSearchResults, error)
- func (v *VectorToolProvider) SearchToolsWithContext(ctx context.Context, query string, contextTools []string, limit int) (ToolSearchResults, error)
- type VectorToolProviderOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CloneableToolProvider ¶ added in v0.1.6
type CloneableToolProvider interface {
ToolProviders
Clone() ToolProviders
}
CloneableToolProvider represents a provider with epigenetic context that should be instantiated freshly for isolated environments (like sub-agents).
type FileToolProvider ¶
type FileToolProvider struct {
// contains filtered or unexported fields
}
FileToolProvider wraps a trpc-agent-go file.ToolSet and satisfies the ToolProviders interface. The tools are pre-computed at construction time because file.ToolSet.Tools requires a context.
func NewFileToolProvider ¶
func NewFileToolProvider(ctx context.Context, workingDir string) *FileToolProvider
NewFileToolProvider creates a ToolProvider for file tools scoped to a working directory. Returns nil if the ToolSet fails to initialise.
type PensieveToolProvider ¶
type PensieveToolProvider struct{}
PensieveToolProvider wraps the Pensieve context management tools (delete_context, check_budget, note, read_notes) and satisfies the ToolProviders interface. Gated behind EnablePensieve in config.
func NewPensieveToolProvider ¶
func NewPensieveToolProvider() *PensieveToolProvider
NewPensieveToolProvider creates a ToolProvider for the Pensieve tools.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds the bootstrapped, filtered set of tools. It evaluates its providers dynamically so that dynamically loaded skills become instantly available in downstream agents without needing a restart.
func NewRegistry ¶
func NewRegistry(ctx context.Context, providers ...ToolProviders) *Registry
NewRegistry collects tools from every supplied ToolProviders conformer and evaluates them dynamically on each GetTools() call. The returned Registry provides the aggregated tool list via AllTools(). Use FilterDenied to subsequently exclude tools blocked by HITL config.
func (*Registry) AllTools ¶
AllTools is a convenience alias for GetTools. Prefer AllTools when calling from application code for readability; GetTools exists to satisfy the ToolProviders interface.
func (*Registry) CloneWithEphemeralProviders ¶ added in v0.1.6
CloneWithEphemeralProviders creates a copy of the Registry and evaluates Clone() on providers that implement CloneableToolProvider, guaranteeing epigenetic isolation. This is used to ensure sub-agents get a fresh, empty state for dynamically loaded skills.
func (*Registry) Exclude ¶
Exclude returns a new Registry that omits tools with the given names. Used to strip orchestration-only tools (e.g. create_agent, send_message) before passing the registry to sub-agents.
func (*Registry) FilterDenied ¶
FilterDenied returns a new Registry that excludes any tools denied by the HITL config. This is the single place where tool-level deny-listing is applied. Without this, denied tools would still be available to agents.
func (*Registry) GetToolDescriptions ¶
func (*Registry) GetTools ¶
GetTools returns the full set of available (non-denied) tools. Satisfies the ToolProviders interface so a Registry can be passed as a provider to another Registry (e.g. codeOwner tools).
func (*Registry) Include ¶
Include returns a new Registry containing only tools whose names appear in the provided list. Unknown names are silently ignored. If names is empty, the original Registry is returned unchanged (all tools available). Used to scope sub-agents to exactly the tools the planner selected.
func (*Registry) UnavailableNames ¶
UnavailableNames returns the subset of the given names that are NOT present in the registry — either because they are denied, excluded, or simply unknown. Used by create_agent to detect when the LLM requests tools that the config has blocked, so it can return an error instead of creating a zero-tool sub-agent.
type ShellToolProvider ¶
type ShellToolProvider struct {
// contains filtered or unexported fields
}
ShellToolProvider wraps the shell tool and satisfies the ToolProviders interface. It encapsulates code executor configuration.
func NewShellToolProvider ¶
func NewShellToolProvider(workingDir string, secrets security.SecretProvider, config unix.ShellToolConfig) *ShellToolProvider
NewShellToolProvider creates a ToolProvider for the run_shell tool. The config controls security features like env var filtering and binary allowlists. The SecretProvider is used to resolve allowed environment variables at runtime.
type SkillLoadConfig ¶ added in v0.1.6
type SkillLoadConfig struct {
MaxLoadedSkills int `yaml:"max_loaded_skills,omitempty" toml:"max_loaded_skills,omitempty"`
SkillsRoots []string `yaml:"skills_roots,omitempty" toml:"skills_roots,omitempty"`
// CreateSkillDir is the writable directory where user-created and learned skills
// are stored. Defaults to ~/.genie/<agentName>/dynamic_skills.
CreateSkillDir string `yaml:"create_skill_dir,omitempty" toml:"create_skill_dir,omitempty"`
}
func DefaultSkillLoadConfig ¶ added in v0.1.6
func DefaultSkillLoadConfig() SkillLoadConfig
type SkillToolProvider ¶ added in v0.1.6
type SkillToolProvider struct {
// contains filtered or unexported fields
}
SkillToolProvider wraps the skill loading tools (skill_list_docs, skill_load, skill_run).
func NewSkillToolProvider ¶ added in v0.1.6
func NewSkillToolProvider(workingDir string, agentName string, config SkillLoadConfig, additionalRepos ...skill.Repository) (*SkillToolProvider, error)
NewSkillToolProvider creates a ToolProvider containing skill discovery tools. A MutableRepository is always created at ~/.genie/<agentName>/dynamic_skills so learned skills can be persisted. The CreateSkillDir config overrides this default path when set. The agentName scopes the skill directory per-agent.
func (*SkillToolProvider) Clone ¶ added in v0.1.6
func (p *SkillToolProvider) Clone() ToolProviders
Clone returns a new SkillToolProvider with a fresh DynamicSkillLoader (empty loaded-skills state) but sharing the same skill repository and code executor. This implements CloneableToolProvider so that CloneWithEphemeralProviders() can isolate dynamic-skill state per sub-agent — without this, skill load/unload state would be shared across all sub-agents. The mutable repo is shared (writes go to the same directory).
func (*SkillToolProvider) Get ¶ added in v0.1.6
func (p *SkillToolProvider) Get(name string) (dynamicskills.Skill, bool)
Get implements dynamicskills.SkillRegistry.
func (*SkillToolProvider) GetTools ¶ added in v0.1.6
func (p *SkillToolProvider) GetTools(_ context.Context) []tool.Tool
GetTools returns the tools needed for agents to dynamically discover and load skills.
func (*SkillToolProvider) MutableRepo ¶
func (p *SkillToolProvider) MutableRepo() *skills.MutableRepository
MutableRepo returns the writable skill repository used by the learning package to persist distilled skills. Always non-nil after construction.
func (*SkillToolProvider) Search ¶ added in v0.1.6
func (p *SkillToolProvider) Search(query string) []dynamicskills.Skill
Search implements dynamicskills.SkillRegistry.
type SmartToolProvider ¶
type SmartToolProvider interface {
// SearchToolsWithContext performs a semantic search and then re-ranks results
// using co-occurrence affinity with the provided context tools. The blended
// score is: 0.7*semantic + 0.3*max(cooccurrence with each contextTool).
SearchToolsWithContext(ctx context.Context, query string, contextTools []string, limit int) (ToolSearchResults, error)
// RecordToolUsage records that the given tools were used together in a
// single task run. This updates the co-occurrence graph by incrementing
// all pairwise edges. The graph is symmetric.
RecordToolUsage(ctx context.Context, toolNames []string)
// GetSearchTool returns a callable tool that the orchestrator can use to dynamically
// discover available tools.
GetSearchTool() tool.Tool
}
SmartToolProvider is a tool provider that can perform semantic search and co-occurrence analysis to find relevant tools.
type ToolProviders ¶
ToolProviders is the interface that all tool-producing types must satisfy in order to be passed to NewRegistry. Each provider is responsible for constructing its own tools from whatever dependencies it holds.
type ToolSearchResult ¶
type ToolSearchResult struct {
Name string `json:"name"`
Description string `json:"description"`
Score float64 `json:"score"`
}
ToolSearchResult represents a tool found via semantic search.
type ToolSearchResults ¶
type ToolSearchResults []ToolSearchResult
func (ToolSearchResults) String ¶
func (results ToolSearchResults) String() string
String formats search results as a concise string suitable for inclusion in LLM prompts. Each tool is listed as "- name: description".
type Tools ¶
Slice is a convenience adapter that wraps a plain []tool.Tool into a ToolProviders conformer. Useful for ad-hoc tool collections that don't belong to a dedicated package (e.g. the codeowner's orchestration-only tool set).
type VectorToolProvider ¶
type VectorToolProvider struct {
// contains filtered or unexported fields
}
VectorToolProvider indexes tool declarations into a vector store and provides semantic search over them. This enables the orchestrator to find relevant tools by goal description instead of listing all tools in prompts — reducing hallucination and prompt bloat.
It also maintains an in-memory co-occurrence graph that learns which tools are commonly used together (AutoTool-style). This graph is built incrementally from TreeResult.ToolCallCounts after each sub-agent run.
Important: this is a **lookup service only**. It does NOT implement the ToolProviders interface and never gives tools to agents directly. Sub-agents receive concrete tools via Registry.Include().
func NewVectorToolProvider ¶
func NewVectorToolProvider(ctx context.Context, store vector.IStore, registry *Registry, graphStore graph.IStore, opts ...VectorToolProviderOption) (*VectorToolProvider, error)
NewVectorToolProvider creates a VectorToolProvider and indexes every tool from the given registry into the vector store. Each tool is stored as a document with ID "tool:<name>", text "<name>: <description>", and metadata type=tool_index.
Optional WithExtraToolIndexTools / WithDynamicToolIndexTools include extra tools in the same index so MCP, integration, and host-injected tools are searchable via embedding and keyword merge.
The indexing is idempotent (upsert) so repeated calls with the same registry are safe.
func (*VectorToolProvider) GetSearchTool ¶
func (v *VectorToolProvider) GetSearchTool() tool.Tool
GetSearchTool returns the "search_tools" meta-tool that the orchestrator uses to discover available tools based on semantic similarity and co-occurrence.
func (*VectorToolProvider) RecordToolUsage ¶
func (v *VectorToolProvider) RecordToolUsage(ctx context.Context, toolNames []string)
RecordToolUsage records that the given tools were used together in a single task run. This updates the co-occurrence graph by incrementing all pairwise edges. The graph is symmetric.
Called after every sub-agent completes with its TreeResult.ToolCallCounts.
func (*VectorToolProvider) SearchTools ¶
func (v *VectorToolProvider) SearchTools(ctx context.Context, query string, limit int) (ToolSearchResults, error)
SearchTools performs a semantic search over indexed tool declarations, returning tools whose descriptions are most relevant to the query. Results are ordered by similarity score (highest first).
func (*VectorToolProvider) SearchToolsWithContext ¶
func (v *VectorToolProvider) SearchToolsWithContext(ctx context.Context, query string, contextTools []string, limit int) (ToolSearchResults, error)
SearchToolsWithContext performs a semantic search and then re-ranks results using co-occurrence affinity with the provided context tools. The blended score is: 0.7*semantic + 0.3*max(cooccurrence with each contextTool).
This makes tool recommendations context-aware: tools that are commonly used alongside the context tools rank higher. If the co-occurrence graph is empty (cold start), results are ranked purely by semantic similarity.
type VectorToolProviderOption ¶
type VectorToolProviderOption func(*vectorToolProviderConfig)
VectorToolProviderOption configures NewVectorToolProvider.
func WithDynamicToolIndexTools ¶
func WithDynamicToolIndexTools(fn func(context.Context) []tool.Tool) VectorToolProviderOption
WithDynamicToolIndexTools registers a callback that returns extra tools to index and to include in keyword-backed search_tools merge. Invoked at VectorToolProvider construction time for indexing, and again at search time for keyword enrichment.
func WithExtraToolIndexTools ¶
func WithExtraToolIndexTools(tools []tool.Tool) VectorToolProviderOption
WithExtraToolIndexTools registers additional tools to upsert into the vector tool index alongside the main registry (e.g. static host-side tools). Later entries with the same tool name overwrite earlier ones.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package datetime provides time and date tools for agents.
|
Package datetime provides time and date tools for agents. |
|
Package doctool provides document parsing tools for agents.
|
Package doctool provides document parsing tools for agents. |
|
Package encodetool provides encoding, decoding, and hashing tools for agents.
|
Package encodetool provides encoding, decoding, and hashing tools for agents. |
|
Package executable provides a generic tool wrapper for arbitrary binaries.
|
Package executable provides a generic tool wrapper for arbitrary binaries. |
|
google
|
|
|
calendar
Package calendar provides calendar management tools for agents.
|
Package calendar provides calendar management tools for agents. |
|
contacts
Package contacts provides Google Contacts (People API) tools for agents.
|
Package contacts provides Google Contacts (People API) tools for agents. |
|
gdrive
Package gdrive provides a DataSource connector that enumerates Google Drive files in configured folders for vectorization.
|
Package gdrive provides a DataSource connector that enumerates Google Drive files in configured folders for vectorization. |
|
gdrive/gdrivefakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
|
gmail
Package gmail provides a DataSource connector that enumerates Gmail messages for given labels for vectorization.
|
Package gmail provides a DataSource connector that enumerates Gmail messages for given labels for vectorization. |
|
oauth
Package oauth: browser_flow runs the OAuth2 authorization code flow by opening the system browser and running a local redirect server to capture the code, then exchanging it for a token and storing it in the device keyring.
|
Package oauth: browser_flow runs the OAuth2 authorization code flow by opening the system browser and running a local redirect server to capture the code, then exchanging it for a token and storing it in the device keyring. |
|
tasks
Package tasks provides Google Tasks API tools for agents.
|
Package tasks provides Google Tasks API tools for agents. |
|
Package jsontool provides JSON querying, validation, and transformation tools backed by gjson (reads) and sjson (writes).
|
Package jsontool provides JSON querying, validation, and transformation tools backed by gjson (reads) and sjson (writes). |
|
Package math provides mathematical tools (a unified arithmetic tool and a calculator/expression evaluator) that can be registered with the tool registry.
|
Package math provides mathematical tools (a unified arithmetic tool and a calculator/expression evaluator) that can be registered with the tool registry. |
|
Package networking provides agent-callable tools for making HTTP requests (GET, POST, etc.) to arbitrary URLs with configurable headers, body, and timeout.
|
Package networking provides agent-callable tools for making HTTP requests (GET, POST, etc.) to arbitrary URLs with configurable headers, body, and timeout. |
|
Package ocrtool provides optical character recognition (OCR) tools for agents.
|
Package ocrtool provides optical character recognition (OCR) tools for agents. |
|
Package pm provides a DataSource connector for issue-tracking systems.
|
Package pm provides a DataSource connector for issue-tracking systems. |
|
pmfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
|
Package regextool provides regular expression tools for agents.
|
Package regextool provides regular expression tools for agents. |
|
Package scm provides a single DataSource connector backed by go-scm for all SCM providers (GitHub, GitLab, Bitbucket).
|
Package scm provides a single DataSource connector backed by go-scm for all SCM providers (GitHub, GitLab, Bitbucket). |
|
scmfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
|
skills
|
|
|
Package sqltool provides SQL database query tools for agents.
|
Package sqltool provides SQL database query tools for agents. |
|
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
|
Package webfetch provides a URL content fetcher for agents.
|
Package webfetch provides a URL content fetcher for agents. |
|
Package youtubetranscript provides a tool to fetch transcript/captions from YouTube videos.
|
Package youtubetranscript provides a tool to fetch transcript/captions from YouTube videos. |