Class: Rubino::Agent::AgentRegistry
- Inherits:
-
Object
- Object
- Rubino::Agent::AgentRegistry
- Defined in:
- lib/rubino/agent/agent_registry.rb
Overview
Registry of all defined agents (primary, sub, utility). Default agent system prompts are stored in agent/prompts/*.txt so they can be edited without modifying Ruby source.
Constant Summary collapse
- PROMPTS_DIR =
File.("prompts", __dir__)
Instance Method Summary collapse
-
#all ⇒ Object
Returns all agents including hidden.
-
#default ⇒ Object
Returns the default primary agent.
-
#find(name) ⇒ Object
Finds an agent by name.
-
#initialize ⇒ AgentRegistry
constructor
A new instance of AgentRegistry.
-
#primary_agents ⇒ Object
Returns all primary agents.
-
#register(definition) ⇒ Object
Registers a custom agent definition.
-
#subagents ⇒ Object
Returns all visible subagents (for @mention).
Constructor Details
#initialize ⇒ AgentRegistry
Returns a new instance of AgentRegistry.
11 12 13 14 |
# File 'lib/rubino/agent/agent_registry.rb', line 11 def initialize @agents = {} register_defaults! end |
Instance Method Details
#all ⇒ Object
Returns all agents including hidden.
27 28 29 |
# File 'lib/rubino/agent/agent_registry.rb', line 27 def all @agents.values end |
#default ⇒ Object
Returns the default primary agent.
42 43 44 |
# File 'lib/rubino/agent/agent_registry.rb', line 42 def default find("build") || primary_agents.first end |
#find(name) ⇒ Object
Finds an agent by name.
32 33 34 |
# File 'lib/rubino/agent/agent_registry.rb', line 32 def find(name) @agents[name.to_s] end |
#primary_agents ⇒ Object
Returns all primary agents.
17 18 19 |
# File 'lib/rubino/agent/agent_registry.rb', line 17 def primary_agents @agents.values.select(&:primary?) end |
#register(definition) ⇒ Object
Registers a custom agent definition.
37 38 39 |
# File 'lib/rubino/agent/agent_registry.rb', line 37 def register(definition) @agents[definition.name] = definition end |
#subagents ⇒ Object
Returns all visible subagents (for @mention).
22 23 24 |
# File 'lib/rubino/agent/agent_registry.rb', line 22 def subagents @agents.values.select { |a| a.subagent? && !a.hidden? } end |