Module: DeepAgentsRb::Graph
- Defined in:
- lib/deepagents/deepagentsrb/graph.rb
Constant Summary collapse
- BASE_PROMPT =
Base prompt for all deep agents
<<~PROMPT You have access to a number of standard tools ## `write_todos` You have access to the `write_todos` tools to help you manage and plan tasks. Use these tools VERY frequently to ensure that you are tracking your tasks and giving the user visibility into your progress. These tools are also EXTREMELY helpful for planning tasks, and for breaking down larger complex tasks into smaller steps. If you do not use this tool when planning, you may forget to do important tasks - and that is unacceptable. It is critical that you mark todos as completed as soon as you are done with a task. Do not batch up multiple tasks before marking them as completed. ## `task` - When doing web search, prefer to use the `task` tool in order to reduce context usage. PROMPT
Class Method Summary collapse
-
.create_deep_agent(tools, instructions, model: nil, subagents: nil, state_schema: nil) ⇒ Object
Create a deep agent.
-
.get_default_model ⇒ Object
Get the default model.
Class Method Details
.create_deep_agent(tools, instructions, model: nil, subagents: nil, state_schema: nil) ⇒ Object
Create a deep agent
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/deepagents/deepagentsrb/graph.rb', line 30 def self.create_deep_agent(tools, instructions, model: nil, subagents: nil, state_schema: nil) # Combine instructions with base prompt prompt = instructions + BASE_PROMPT # Get built-in tools built_in_tools = Tools.built_in_tools # Set default model if not provided model ||= get_default_model # Set default state schema state_schema ||= DeepAgentState # Convert subagents to proper format if provided subagents = (subagents || []).map do |agent| if agent.is_a?(Hash) SubAgent.from_h(agent) else agent end end # Create task tool for delegating to sub-agents task_tool = SubAgentSystem.create_task_tool( tools + built_in_tools, instructions, subagents, model, state_schema ) # Combine all tools all_tools = built_in_tools + tools + [task_tool] # Create and return the deep agent DeepAgent.new(model, prompt, all_tools, state_schema) end |
.get_default_model ⇒ Object
Get the default model
25 26 27 |
# File 'lib/deepagents/deepagentsrb/graph.rb', line 25 def self.get_default_model Models.get_default_model end |