Documentation
¶
Overview ¶
Package agent provides the AI agent runtime for omniagent.
Index ¶
- type Agent
- func (a *Agent) ActivateProfile(ctx context.Context, name string) error
- func (a *Agent) ClearSession(ctx context.Context, sessionID string) error
- func (a *Agent) Close() error
- func (a *Agent) CloseCompiledSkills() error
- func (a *Agent) ContextEngine() *agentctx.Engine
- func (a *Agent) DeleteSession(ctx context.Context, sessionID string) error
- func (a *Agent) Dispatcher() *hooks.Dispatcher
- func (a *Agent) GetCompiledSkills() []compiled.Skill
- func (a *Agent) GetSession(ctx context.Context, sessionID string) (*sessions.Session, error)
- func (a *Agent) GetSkills() []*skills.Skill
- func (a *Agent) HookRegistry() *hooks.Registry
- func (a *Agent) InitCompiledSkills(ctx context.Context) error
- func (a *Agent) InitHooks(ctx context.Context) error
- func (a *Agent) LeanMode() *profiles.LeanMode
- func (a *Agent) ListSessions(ctx context.Context) ([]string, error)
- func (a *Agent) LoadSkills(dirs []string) error
- func (a *Agent) Memory() *core.Client
- func (a *Agent) Process(ctx context.Context, sessionID, content string) (string, error)
- func (a *Agent) ProcessWithMemory(ctx context.Context, sessionID, content string) (string, error)
- func (a *Agent) ProcessWithSession(ctx context.Context, sessionID, content string) (string, error)
- func (a *Agent) Profile() *profiles.BootstrapProfile
- func (a *Agent) ProfileRegistry() *profiles.ProfileRegistry
- func (a *Agent) ProgressReporter() *profiles.ProgressReporter
- func (a *Agent) RegisterCompiledSkill(skill compiled.Skill) error
- func (a *Agent) RegisterTool(tool Tool)
- func (a *Agent) SessionStore() *sessions.Store
- func (a *Agent) SetContextEngine(engine *agentctx.Engine)
- func (a *Agent) SetLeanMode(mode *profiles.LeanMode)
- func (a *Agent) SetMemory(client *core.Client)
- func (a *Agent) SetProfile(profile *profiles.BootstrapProfile)
- func (a *Agent) SetProgressReporter(reporter *profiles.ProgressReporter)
- func (a *Agent) SetStorage(s kvs.Store)
- func (a *Agent) SkillManager() *skills.Manager
- func (a *Agent) Tools() *ToolRegistry
- type Axis
- type BaseTool
- type ChartArgs
- type ChartIR
- type ChartTool
- type Column
- type Config
- type Dataset
- type Legend
- type Mark
- type MarkStyle
- type Option
- func WithBootstrapProfile(profile *profiles.BootstrapProfile) Option
- func WithCompiledHook(hook hooks.Hook) Option
- func WithCompiledSkill(skill compiled.Skill) Option
- func WithContextConfig(cfg agentctx.Config) Option
- func WithContextEngine(engine *agentctx.Engine) Option
- func WithCronScheduler() Option
- func WithHook(event hooks.EventType, handler hooks.HandlerFunc) Option
- func WithLeanLevel(level profiles.LeanLevel) Option
- func WithLeanMode(mode *profiles.LeanMode) Option
- func WithMCPSkill(cfg mcpskill.Config) Option
- func WithMaxMessages(max int) Option
- func WithMemory(client *core.Client) Option
- func WithMemoryConfig(cfg core.ClientConfig) Option
- func WithNamedHook(event hooks.EventType, name string, handler hooks.HandlerFunc) Option
- func WithOpenAPISkill(cfg openapiskill.Config) Option
- func WithProfileRegistry(registry *profiles.ProfileRegistry) Option
- func WithProgressMode(mode profiles.ProgressDetailMode, output io.Writer) Option
- func WithProgressReporter(reporter *profiles.ProgressReporter) Option
- func WithSessionStore(store *sessions.Store) Option
- func WithSessionsFromStorage(backend kvs.Store) Option
- func WithSkillDirs(dirs ...string) Option
- func WithSkillExcludes(names ...string) Option
- func WithSkillIncludes(names ...string) Option
- func WithSkillManager(mgr *skills.Manager) Option
- func WithSkillPack(pack fs.FS) Option
- func WithStorage(s kvs.Store) Option
- func WithTool(tool Tool) Option
- func WithWebhookHook(webhook *hooks.WebhookHook) Option
- type SearchArgs
- type SearchTool
- type Sessiondeprecated
- func (sess *Session) AddMessage(role provider.Role, content string)
- func (sess *Session) Clear()
- func (sess *Session) GetMessages() []provider.Message
- func (sess *Session) GetMetadata(key string) (interface{}, bool)
- func (sess *Session) SetMetadata(key string, value interface{})
- func (sess *Session) Trim(n int)
- type SessionStoredeprecated
- type Tool
- type ToolNotFoundError
- type ToolRegistry
- func (r *ToolRegistry) Execute(ctx context.Context, name string, args json.RawMessage) (string, error)
- func (r *ToolRegistry) Get(name string) (Tool, bool)
- func (r *ToolRegistry) GetTools() []provider.Tool
- func (r *ToolRegistry) List() []string
- func (r *ToolRegistry) Register(tool Tool)
- func (r *ToolRegistry) Unregister(name string)
- type Tooltip
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent is the AI agent that processes messages.
func New ¶
New creates a new agent with optional configuration.
Example:
agent, err := agent.New(config,
agent.WithStorage(sqliteStorage),
agent.WithCompiledSkill(investSkill),
)
func (*Agent) ActivateProfile ¶ added in v0.9.0
ActivateProfile activates a profile by name from the registry. Returns an error if the profile is not found.
func (*Agent) ClearSession ¶ added in v0.6.0
ClearSession clears the conversation history for a session.
func (*Agent) CloseCompiledSkills ¶ added in v0.5.0
CloseCompiledSkills closes all registered compiled skills.
func (*Agent) ContextEngine ¶ added in v0.6.0
ContextEngine returns the context engine, or nil if not configured.
func (*Agent) DeleteSession ¶ added in v0.6.0
DeleteSession removes a session.
func (*Agent) Dispatcher ¶ added in v0.6.0
func (a *Agent) Dispatcher() *hooks.Dispatcher
Dispatcher returns the event dispatcher.
func (*Agent) GetCompiledSkills ¶ added in v0.5.0
GetCompiledSkills returns all registered compiled skills.
func (*Agent) GetSession ¶ added in v0.6.0
GetSession retrieves a session by ID. Returns nil if sessions are not configured or session doesn't exist.
func (*Agent) HookRegistry ¶ added in v0.6.0
HookRegistry returns the hook registry.
func (*Agent) InitCompiledSkills ¶ added in v0.5.0
InitCompiledSkills initializes all registered compiled skills.
func (*Agent) LeanMode ¶ added in v0.9.0
LeanMode returns the lean mode configuration, or nil if not set.
func (*Agent) ListSessions ¶ added in v0.6.0
ListSessions returns all session IDs.
func (*Agent) LoadSkills ¶
LoadSkills loads skills from the given directories.
func (*Agent) Memory ¶ added in v0.11.0
Memory returns the omnimemory client, or nil if not configured.
func (*Agent) Process ¶
Process processes a message and returns a response. This is a stateless call that doesn't use session history. Use ProcessWithSession for conversation continuity.
func (*Agent) ProcessWithMemory ¶
ProcessWithMemory processes a message using conversation memory. Deprecated: Use ProcessWithSession instead.
func (*Agent) ProcessWithSession ¶ added in v0.6.0
ProcessWithSession processes a message using persistent session history. Conversation history is automatically loaded and saved.
func (*Agent) Profile ¶ added in v0.9.0
func (a *Agent) Profile() *profiles.BootstrapProfile
Profile returns the active bootstrap profile, or nil if not set.
func (*Agent) ProfileRegistry ¶ added in v0.9.0
func (a *Agent) ProfileRegistry() *profiles.ProfileRegistry
ProfileRegistry returns the profile registry, or nil if not configured.
func (*Agent) ProgressReporter ¶ added in v0.9.0
func (a *Agent) ProgressReporter() *profiles.ProgressReporter
ProgressReporter returns the progress reporter, or nil if not configured.
func (*Agent) RegisterCompiledSkill ¶ added in v0.5.0
RegisterCompiledSkill registers a compiled skill with the agent. This converts the skill's tools to agent tools and registers them.
func (*Agent) RegisterTool ¶
RegisterTool registers a tool with the agent.
func (*Agent) SessionStore ¶ added in v0.6.0
SessionStore returns the session store, or nil if not configured.
func (*Agent) SetContextEngine ¶ added in v0.6.0
SetContextEngine sets the context engine.
func (*Agent) SetLeanMode ¶ added in v0.9.0
SetLeanMode sets the lean mode configuration.
func (*Agent) SetProfile ¶ added in v0.9.0
func (a *Agent) SetProfile(profile *profiles.BootstrapProfile)
SetProfile sets the active bootstrap profile.
func (*Agent) SetProgressReporter ¶ added in v0.9.0
func (a *Agent) SetProgressReporter(reporter *profiles.ProgressReporter)
SetProgressReporter sets the progress reporter.
func (*Agent) SetStorage ¶ added in v0.5.0
SetStorage sets the storage backend for the agent. This also injects storage into any storage-aware compiled skills.
func (*Agent) SkillManager ¶ added in v0.7.0
SkillManager returns the skill manager, or nil if not configured.
func (*Agent) Tools ¶ added in v0.10.0
func (a *Agent) Tools() *ToolRegistry
Tools returns the tool registry for accessing registered tools.
type BaseTool ¶
type BaseTool struct {
// contains filtered or unexported fields
}
BaseTool provides a base implementation for tools.
func NewBaseTool ¶
func NewBaseTool(name, description string, parameters map[string]interface{}, handler func(ctx context.Context, args json.RawMessage) (string, error)) *BaseTool
NewBaseTool creates a new base tool.
func (*BaseTool) Description ¶
func (*BaseTool) Parameters ¶
type ChartArgs ¶ added in v0.11.0
type ChartArgs struct {
Title string `json:"title"`
ChartType string `json:"chart_type"` // "line", "bar", "pie", "area", "scatter"
XColumn string `json:"x_column"` // Name of x-axis column
YColumns []string `json:"y_columns"` // Names of y-axis columns (for multi-series)
Data [][]interface{} `json:"data"` // Array of rows, each row matches columns order
Smooth bool `json:"smooth,omitempty"`
Stacked bool `json:"stacked,omitempty"`
ShowLegend bool `json:"show_legend,omitempty"`
}
ChartArgs are the arguments for the chart tool.
type ChartIR ¶ added in v0.11.0
type ChartIR struct {
Title string `json:"title,omitempty"`
Datasets []Dataset `json:"datasets"`
Marks []Mark `json:"marks"`
Axes []Axis `json:"axes,omitempty"`
Legend *Legend `json:"legend,omitempty"`
Tooltip *Tooltip `json:"tooltip,omitempty"`
}
ChartIR represents the intermediate representation for charts.
type ChartTool ¶ added in v0.11.0
type ChartTool struct{}
ChartTool provides chart rendering capabilities using ChartIR format.
func NewChartTool ¶ added in v0.11.0
func NewChartTool() *ChartTool
NewChartTool creates a new chart tool.
func (*ChartTool) Description ¶ added in v0.11.0
func (*ChartTool) Parameters ¶ added in v0.11.0
type Config ¶
type Config struct {
Provider string
Model string
APIKey string //nolint:gosec // G117: APIKey is intentionally stored for provider authentication
BaseURL string
Temperature float64
MaxTokens int
SystemPrompt string
Logger *slog.Logger
ObservabilityHook omnillm.ObservabilityHook
// Memory configuration
TenantID string // Tenant ID for multi-tenancy (memory scope)
AgentID string // Agent ID for memory attribution
}
Config configures the agent.
type Mark ¶ added in v0.11.0
type Mark struct {
ID string `json:"id"`
DatasetID string `json:"datasetId"`
Geometry string `json:"geometry"`
Encode map[string]string `json:"encode"`
Name string `json:"name,omitempty"`
Smooth bool `json:"smooth,omitempty"`
Stack string `json:"stack,omitempty"`
Style *MarkStyle `json:"style,omitempty"`
}
type Option ¶ added in v0.5.0
Option configures the agent.
func WithBootstrapProfile ¶ added in v0.9.0
func WithBootstrapProfile(profile *profiles.BootstrapProfile) Option
WithBootstrapProfile sets the bootstrap profile for agent initialization. Profiles customize system prompts, tools, and context limits per-agent.
Example:
agent, err := agent.New(config,
agent.WithBootstrapProfile(profiles.CodeAssistantProfile),
)
func WithCompiledHook ¶ added in v0.6.0
WithCompiledHook registers a compiled hook for handling events. Compiled hooks implement the hooks.Hook interface and support initialization, cleanup, and multi-event handling.
Example:
type AuditHook struct {
logger *slog.Logger
}
func (h *AuditHook) Name() string { return "audit" }
func (h *AuditHook) Events() []hooks.EventType {
return []hooks.EventType{hooks.EventMessageReceived, hooks.EventMessageSent}
}
func (h *AuditHook) Handle(ctx context.Context, event hooks.Event) error {
h.logger.Info("event", "type", event.Type, "data", event.Data)
return nil
}
func (h *AuditHook) Init(ctx context.Context) error { return nil }
func (h *AuditHook) Close() error { return nil }
agent, err := agent.New(config,
agent.WithCompiledHook(&AuditHook{logger: slog.Default()}),
)
func WithCompiledSkill ¶ added in v0.5.0
WithCompiledSkill registers a compiled skill with the agent. Multiple skills can be registered by calling this option multiple times.
Example:
agent, err := agent.New(config,
agent.WithCompiledSkill(investSkill),
agent.WithCompiledSkill(weatherSkill),
)
func WithContextConfig ¶ added in v0.6.0
WithContextConfig creates a context engine with the given configuration. This is a convenience option for simple context configuration.
Example:
agent, err := agent.New(config,
agent.WithContextConfig(context.Config{
MaxMessages: 50,
MaxTokens: 8000,
}),
)
func WithContextEngine ¶ added in v0.6.0
WithContextEngine sets the context engine for conversation management. This enables automatic windowing and token limit enforcement.
Example:
engine := context.New(context.Config{
MaxMessages: 50,
MaxTokens: 8000,
})
agent, err := agent.New(config,
agent.WithContextEngine(engine),
)
func WithCronScheduler ¶ added in v0.6.0
func WithCronScheduler() Option
WithCronScheduler registers the cron skill for scheduled job execution. This requires storage to be configured (use WithStorage or WithSessionsFromStorage).
Example:
sqliteStore, _ := sqlite.New(sqlite.Config{Path: "data.db"})
agent, err := agent.New(config,
agent.WithSessionsFromStorage(sqliteStore),
agent.WithCronScheduler(),
)
func WithHook ¶ added in v0.6.0
func WithHook(event hooks.EventType, handler hooks.HandlerFunc) Option
WithHook registers a quick handler for an event type. This is the simplest way to handle events.
Example:
agent, err := agent.New(config,
agent.WithHook(hooks.EventMessageReceived, func(ctx context.Context, e hooks.Event) error {
msg := e.Data.(hooks.MessageEvent)
log.Printf("Received: %s", msg.Content)
return nil
}),
)
func WithLeanLevel ¶ added in v0.9.0
WithLeanLevel enables lean mode at the specified level. This is a convenience function for common lean mode configurations.
Example:
agent, err := agent.New(config,
agent.WithLeanLevel(profiles.LeanLevelLight),
)
func WithLeanMode ¶ added in v0.9.0
WithLeanMode enables lean mode for resource optimization. This is especially useful for local models with limited resources.
Example:
agent, err := agent.New(config,
agent.WithLeanMode(profiles.NewLeanMode(profiles.LeanLevelModerate)),
)
func WithMCPSkill ¶ added in v0.6.0
WithMCPSkill registers an MCP server as a compiled skill. This spawns the MCP server as a subprocess and exposes its tools to the agent.
Example:
agent, err := agent.New(config,
agent.WithMCPSkill(mcpskill.Config{
Name: "github",
Command: []string{"npx", "-y", "@modelcontextprotocol/server-github"},
Env: map[string]string{
"GITHUB_TOKEN": os.Getenv("GITHUB_TOKEN"),
},
}),
)
func WithMaxMessages ¶ added in v0.6.0
WithMaxMessages sets a simple message limit for context. This creates a context engine with only a message limit.
Example:
agent, err := agent.New(config,
agent.WithMaxMessages(50),
)
func WithMemory ¶ added in v0.11.0
WithMemory sets the omnimemory client for semantic memory operations. This enables memory_store, memory_search, memory_recall, and other tools.
Example:
client, _ := core.NewClient(core.ClientConfig{
Providers: []core.ProviderConfig{
{Name: core.ProviderNameMemory},
},
})
agent, err := agent.New(config,
agent.WithMemory(client),
)
func WithMemoryConfig ¶ added in v0.11.0
func WithMemoryConfig(cfg core.ClientConfig) Option
WithMemoryConfig creates an omnimemory client with the given configuration. This is a convenience option that creates the client from configuration.
Example:
agent, err := agent.New(config,
agent.WithMemoryConfig(core.ClientConfig{
Providers: []core.ProviderConfig{
{Name: core.ProviderNamePostgres, DSN: os.Getenv("DATABASE_URL")},
},
}),
)
func WithNamedHook ¶ added in v0.6.0
WithNamedHook registers a named handler for an event type. The name is used in logging to identify the handler.
Example:
agent, err := agent.New(config,
agent.WithNamedHook(hooks.EventMessageReceived, "audit-log", func(ctx context.Context, e hooks.Event) error {
msg := e.Data.(hooks.MessageEvent)
log.Printf("[AUDIT] Received: %s", msg.Content)
return nil
}),
)
func WithOpenAPISkill ¶ added in v0.8.0
func WithOpenAPISkill(cfg openapiskill.Config) Option
WithOpenAPISkill registers an OpenAPI spec as a compiled skill. This parses the OpenAPI specification and exposes operations as tools.
Example:
agent, err := agent.New(config,
agent.WithOpenAPISkill(openapiskill.Config{
Name: "petstore",
SpecURL: "https://petstore3.swagger.io/api/v3/openapi.json",
Auth: openapiskill.AuthConfig{
Type: openapiskill.AuthAPIKey,
APIKey: os.Getenv("PETSTORE_API_KEY"),
},
}),
)
func WithProfileRegistry ¶ added in v0.9.0
func WithProfileRegistry(registry *profiles.ProfileRegistry) Option
WithProfileRegistry sets a profile registry for dynamic profile selection. This allows switching profiles at runtime based on context.
Example:
registry := profiles.NewProfileRegistry()
registry.Register(profiles.CodeAssistantProfile)
registry.Register(profiles.RestrictedProfile)
agent, err := agent.New(config,
agent.WithProfileRegistry(registry),
)
func WithProgressMode ¶ added in v0.9.0
func WithProgressMode(mode profiles.ProgressDetailMode, output io.Writer) Option
WithProgressMode sets the progress detail mode for tool execution. This is a convenience function that creates a progress reporter with the given mode.
Example:
agent, err := agent.New(config,
agent.WithProgressMode(profiles.ProgressModeVerbose, os.Stderr),
)
func WithProgressReporter ¶ added in v0.9.0
func WithProgressReporter(reporter *profiles.ProgressReporter) Option
WithProgressReporter sets the progress reporter for tool execution. This controls how tool execution progress is displayed.
Example:
reporter := profiles.NewProgressReporter(profiles.ProgressModeVerbose, os.Stderr)
agent, err := agent.New(config,
agent.WithProgressReporter(reporter),
)
func WithSessionStore ¶ added in v0.6.0
WithSessionStore sets the session store for conversation persistence. This enables ProcessWithSession to maintain conversation history.
Example:
sqliteStore, _ := sqlite.New(sqlite.Config{Path: "data.db"})
sessionStore := sessions.NewStore(sessions.StoreConfig{Backend: sqliteStore})
agent, err := agent.New(config,
agent.WithSessionStore(sessionStore),
)
func WithSessionsFromStorage ¶ added in v0.6.0
WithSessionsFromStorage creates a session store from the given KVS backend. This is a convenience option that combines WithStorage and WithSessionStore.
Example:
sqliteStore, _ := sqlite.New(sqlite.Config{Path: "data.db"})
agent, err := agent.New(config,
agent.WithSessionsFromStorage(sqliteStore),
)
func WithSkillDirs ¶ added in v0.7.0
WithSkillDirs sets the directories to search for skills. Directory skills override embedded skills with the same name.
Example:
agent, err := agent.New(config,
agent.WithSkillDirs("./skills", "~/.omniagent/skills"),
)
func WithSkillExcludes ¶ added in v0.7.0
WithSkillExcludes prevents skills with matching names from being loaded. Applied after includes.
Example:
agent, err := agent.New(config,
agent.WithSkillPack(skills.Default().FS()),
agent.WithSkillExcludes("slack", "trello"),
)
func WithSkillIncludes ¶ added in v0.7.0
WithSkillIncludes limits loaded skills to only those with matching names. If not set, all discovered skills are included.
Example:
agent, err := agent.New(config,
agent.WithSkillPack(skills.Default().FS()),
agent.WithSkillIncludes("github", "weather"),
)
func WithSkillManager ¶ added in v0.7.0
WithSkillManager sets a custom skill manager for the agent. Use this for advanced skill loading scenarios.
Example:
mgr := skills.NewManager(skills.ManagerConfig{
Packs: []fs.FS{skills.Default().FS()},
Dirs: []string{"./custom-skills"},
Includes: []string{"github"},
})
mgr.Load()
agent, err := agent.New(config,
agent.WithSkillManager(mgr),
)
func WithSkillPack ¶ added in v0.7.0
WithSkillPack registers an embedded skill pack with the agent. Skills from packs are loaded after directory skills, so directory skills with the same name will override pack skills.
Example:
import skills "github.com/plexusone/omniagent-skills"
agent, err := agent.New(config,
agent.WithSkillPack(skills.Default().FS()),
)
func WithStorage ¶ added in v0.5.0
WithStorage sets the storage backend for the agent. Storage is automatically injected into any storage-aware compiled skills.
Example:
sqliteStore, _ := sqlite.New(sqlite.Config{Path: "data.db"})
agent, err := agent.New(config,
agent.WithStorage(sqliteStore),
agent.WithCompiledSkill(investSkill),
)
func WithTool ¶ added in v0.5.0
WithTool registers a single tool with the agent.
Example:
agent, err := agent.New(config,
agent.WithTool(myTool),
)
func WithWebhookHook ¶ added in v0.6.0
func WithWebhookHook(webhook *hooks.WebhookHook) Option
WithWebhookHook registers a webhook-based hook that sends events to an HTTP endpoint.
Example:
agent, err := agent.New(config,
agent.WithWebhookHook(&hooks.WebhookHook{
HookName: "slack-notify",
HookEvents: []hooks.EventType{hooks.EventMessageSent},
URL: "https://hooks.slack.com/services/xxx",
Method: "POST",
Timeout: 5 * time.Second,
}),
)
type SearchArgs ¶
type SearchArgs struct {
Query string `json:"query"`
Type string `json:"type,omitempty"` // "web", "news", "images" (default: "web")
}
SearchArgs are the arguments for the search tool.
type SearchTool ¶
type SearchTool struct {
// contains filtered or unexported fields
}
SearchTool provides web search capabilities via omniserp.
func NewSearchTool ¶
func NewSearchTool() (*SearchTool, error)
NewSearchTool creates a new search tool.
func (*SearchTool) Description ¶
func (t *SearchTool) Description() string
func (*SearchTool) Execute ¶
func (t *SearchTool) Execute(ctx context.Context, argsJSON json.RawMessage) (string, error)
func (*SearchTool) Name ¶
func (t *SearchTool) Name() string
func (*SearchTool) Parameters ¶
func (t *SearchTool) Parameters() map[string]interface{}
type Session
deprecated
type Session struct {
ID string
Messages []provider.Message
CreatedAt time.Time
UpdatedAt time.Time
Metadata map[string]interface{}
// contains filtered or unexported fields
}
Session represents a conversation session.
Deprecated: Use sessions.Session from github.com/plexusone/omniagent/sessions.
func (*Session) AddMessage ¶
AddMessage adds a message to the session.
func (*Session) GetMessages ¶
GetMessages returns all messages in the session.
func (*Session) GetMetadata ¶
GetMetadata gets a metadata value.
func (*Session) SetMetadata ¶
SetMetadata sets a metadata value.
type SessionStore
deprecated
type SessionStore struct {
// contains filtered or unexported fields
}
SessionStore manages conversation sessions.
Deprecated: Use sessions.Store from github.com/plexusone/omniagent/sessions.
func NewSessionStore ¶
func NewSessionStore() *SessionStore
NewSessionStore creates a new session store.
func (*SessionStore) Get ¶
func (s *SessionStore) Get(id string) *Session
Get retrieves a session by ID, creating one if it doesn't exist.
type Tool ¶
type Tool interface {
// Name returns the tool name.
Name() string
// Description returns a description of what the tool does.
Description() string
// Parameters returns the JSON schema for the tool parameters.
Parameters() map[string]interface{}
// Execute runs the tool with the given arguments.
Execute(ctx context.Context, args json.RawMessage) (string, error)
}
Tool represents an agent tool that can be invoked.
type ToolNotFoundError ¶
type ToolNotFoundError struct {
Name string
}
ToolNotFoundError is returned when a tool is not found.
func (*ToolNotFoundError) Error ¶
func (e *ToolNotFoundError) Error() string
type ToolRegistry ¶
type ToolRegistry struct {
// contains filtered or unexported fields
}
ToolRegistry manages available tools.
func NewToolRegistry ¶
func NewToolRegistry() *ToolRegistry
NewToolRegistry creates a new tool registry.
func (*ToolRegistry) Execute ¶
func (r *ToolRegistry) Execute(ctx context.Context, name string, args json.RawMessage) (string, error)
Execute runs a tool by name with the given arguments.
func (*ToolRegistry) Get ¶
func (r *ToolRegistry) Get(name string) (Tool, bool)
Get retrieves a tool by name.
func (*ToolRegistry) GetTools ¶
func (r *ToolRegistry) GetTools() []provider.Tool
GetTools returns tool definitions for the LLM.
func (*ToolRegistry) List ¶
func (r *ToolRegistry) List() []string
List returns all registered tool names.
func (*ToolRegistry) Register ¶
func (r *ToolRegistry) Register(tool Tool)
Register adds a tool to the registry.
func (*ToolRegistry) Unregister ¶
func (r *ToolRegistry) Unregister(name string)
Unregister removes a tool from the registry.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package profiles provides agent-specific initialization profiles.
|
Package profiles provides agent-specific initialization profiles. |
|
Package registry provides multi-agent management for OmniAgent.
|
Package registry provides multi-agent management for OmniAgent. |