Class: RailsAi::Agents::ResearchAgent
- Defined in:
- lib/rails_ai/agents/specialized_agents.rb
Overview
Research Agent - Specialized in gathering and analyzing information
Instance Attribute Summary
Attributes inherited from BaseAgent
#active_tasks, #capabilities, #completed_tasks, #created_at, #failed_tasks, #last_activity, #memory, #name, #role, #state
Instance Method Summary collapse
- #fact_check(claim) ⇒ Object
-
#initialize(name: "ResearchAgent", **opts) ⇒ ResearchAgent
constructor
A new instance of ResearchAgent.
- #research_topic(topic, depth: :standard) ⇒ Object
Methods inherited from BaseAgent
#accept_delegated_task, #assign_task, #can_handle_task?, #collaborate_with, #complete_task, #decide_next_action, #delegate_task, #fail_task, #forget, #get_messages, #has_capability?, #health_check, #pause!, #recall, #receive_message, #remember, #resume!, #send_message, #start!, #status, #stop!, #think
Constructor Details
#initialize(name: "ResearchAgent", **opts) ⇒ ResearchAgent
Returns a new instance of ResearchAgent.
7 8 9 10 11 12 13 14 |
# File 'lib/rails_ai/agents/specialized_agents.rb', line 7 def initialize(name: "ResearchAgent", **opts) super( name: name, role: "Research Specialist", capabilities: [:research, :analysis, :data_gathering, :fact_checking], **opts ) end |
Instance Method Details
#fact_check(claim) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/rails_ai/agents/specialized_agents.rb', line 26 def fact_check(claim) return "[stubbed] Fact check: #{claim}" if RailsAi.config.stub_responses fact_check_prompt = build_fact_check_prompt(claim) result = think(fact_check_prompt, context: { claim: claim }) remember("fact_check_#{claim.hash}", result, importance: :normal) result end |
#research_topic(topic, depth: :standard) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/rails_ai/agents/specialized_agents.rb', line 16 def research_topic(topic, depth: :standard) return "[stubbed] Research on #{topic}" if RailsAi.config.stub_responses research_prompt = build_research_prompt(topic, depth) result = think(research_prompt, context: { topic: topic, depth: depth }) remember("research_#{topic}_#{Time.now.to_i}", result, importance: :high) result end |