mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-11 01:34:45 +08:00
feat: integrated with sandbox
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from .lead_agent import lead_agent
|
||||
from .thread_state import SandboxState, ThreadState
|
||||
|
||||
__all__ = ["lead_agent"]
|
||||
__all__ = ["lead_agent", "SandboxState", "ThreadState"]
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
from langchain.agents import create_agent
|
||||
|
||||
from src.agents.lead_agent.prompt import apply_prompt_template
|
||||
from src.agents.thread_state import ThreadState
|
||||
from src.models import create_chat_model
|
||||
from src.sandbox.middleware import SandboxMiddleware
|
||||
from src.tools import get_available_tools
|
||||
|
||||
lead_agent = create_agent(
|
||||
model=create_chat_model(thinking_enabled=True),
|
||||
tools=get_available_tools(),
|
||||
middleware=[SandboxMiddleware()],
|
||||
system_prompt=apply_prompt_template(),
|
||||
state_schema=ThreadState,
|
||||
)
|
||||
|
||||
11
backend/src/agents/thread_state.py
Normal file
11
backend/src/agents/thread_state.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from typing import TypedDict
|
||||
|
||||
from langchain.agents import AgentState
|
||||
|
||||
|
||||
class SandboxState(TypedDict):
|
||||
sandbox_id: str | None = None
|
||||
|
||||
|
||||
class ThreadState(AgentState):
|
||||
sandbox: SandboxState | None = None
|
||||
Reference in New Issue
Block a user