mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-18 03:54:46 +08:00
feat: lite deep researcher implementation
This commit is contained in:
3
src/agents/__init__.py
Normal file
3
src/agents/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from .agents import research_agent, coder_agent
|
||||
|
||||
__all__ = ["research_agent", "coder_agent"]
|
||||
30
src/agents/agents.py
Normal file
30
src/agents/agents.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from langgraph.prebuilt import create_react_agent
|
||||
|
||||
from src.prompts import apply_prompt_template
|
||||
from src.tools import (
|
||||
bash_tool,
|
||||
crawl_tool,
|
||||
python_repl_tool,
|
||||
tavily_tool,
|
||||
)
|
||||
|
||||
from src.llms.llm import get_llm_by_type
|
||||
from src.config.agents import AGENT_LLM_MAP
|
||||
|
||||
|
||||
# Create agents using configured LLM types
|
||||
def create_agent(agent_name: str, agent_type: str, tools: list, prompt_template: str):
|
||||
"""Factory function to create agents with consistent configuration."""
|
||||
return create_react_agent(
|
||||
name=agent_name,
|
||||
model=get_llm_by_type(AGENT_LLM_MAP[agent_type]),
|
||||
tools=tools,
|
||||
prompt=lambda state: apply_prompt_template(prompt_template, state),
|
||||
)
|
||||
|
||||
|
||||
# Create agents using the factory function
|
||||
research_agent = create_agent(
|
||||
"researcher", "researcher", [tavily_tool, crawl_tool], "researcher"
|
||||
)
|
||||
coder_agent = create_agent("coder", "coder", [python_repl_tool, bash_tool], "coder")
|
||||
Reference in New Issue
Block a user