Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
feat: add Deep Agent specialized node powered by LangChain deepagents
trohitgc6121c53142e
diff --git a/client/src/components/AIAgentNode.tsx b/client/src/components/AIAgentNode.tsxindex b48a18ae..91d579c3 100644--- a/client/src/components/AIAgentNode.tsx+++ b/client/src/components/AIAgentNode.tsx@@ -379,6 +379,24 @@ const AGENT_CONFIGS: Record<string, AgentConfig> = {width: 300,height: 200,},+ deep_agent: {+ icon: <span style={{ fontSize: '28px' }}>{'\u{1F9E0}'}</span>,+ title: 'Deep Agent',+ subtitle: 'LangChain DeepAgents',+ themeColorKey: 'green',+ bottomHandles: [+ { id: 'input-skill', label: 'Skill', position: '20%' },+ { id: 'input-teammates', label: 'Team', position: '50%' },+ { id: 'input-tools', label: 'Tool', position: '80%' },+ ],+ leftHandles: [+ { id: 'input-memory', label: 'Memory', position: '65%' },+ { id: 'input-task', label: 'Task', position: '85%' },+ ],+ topOutputHandle: { id: 'output-top', label: 'Output' },+ width: 300,+ height: 200,+ },};const AIAgentNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnectable, selected }) => {diff --git a/client/src/components/parameterPanel/InputSection.tsx b/client/src/components/parameterPanel/InputSection.tsxindex 44c53aad..6be71dde 100644--- a/client/src/components/parameterPanel/InputSection.tsx+++ b/client/src/components/parameterPanel/InputSection.tsx@@ -89,7 +89,7 @@ const InputSection: React.FC<InputSectionProps> = ({ nodeId, visible = true }) ='aiAgent', 'chatAgent', 'android_agent', 'coding_agent','web_agent', 'task_agent', 'social_agent', 'travel_agent','tool_agent', 'productivity_agent', 'payments_agent', 'consumer_agent',- 'autonomous_agent', 'orchestrator_agent', 'ai_employee', 'rlm_agent', 'claude_code_agent'+ 'autonomous_agent', 'orchestrator_agent', 'ai_employee', 'rlm_agent', 'claude_code_agent', 'deep_agent'];// Check if current node is an agent that shows skills in Middle Sectionconst isAgentWithSkills = AGENT_WITH_SKILLS_TYPES.includes(currentNodeType || '');@@ -729,7 +729,7 @@ const InputSection: React.FC<InputSectionProps> = ({ nodeId, visible = true }) =const isMemory = nodeType === 'simpleMemory';const nodeTypeLower = nodeType.toLowerCase();// AI agent types that use the AI output schema- const aiAgentTypes = ['aiAgent', 'chatAgent', 'android_agent', 'coding_agent', 'web_agent', 'task_agent', 'social_agent', 'travel_agent', 'tool_agent', 'productivity_agent', 'payments_agent', 'consumer_agent', 'autonomous_agent', 'orchestrator_agent', 'ai_employee', 'rlm_agent', 'claude_code_agent'];+ const aiAgentTypes = ['aiAgent', 'chatAgent', 'android_agent', 'coding_agent', 'web_agent', 'task_agent', 'social_agent', 'travel_agent', 'tool_agent', 'productivity_agent', 'payments_agent', 'consumer_agent', 'autonomous_agent', 'orchestrator_agent', 'ai_employee', 'rlm_agent', 'claude_code_agent', 'deep_agent'];const isAI = !isMemory && (nodeTypeLower.includes('chatmodel') || aiAgentTypes.includes(nodeType));const isFile = nodeType.includes('file');const isWhatsAppDb = nodeType === 'whatsappDb';diff --git a/client/src/components/parameterPanel/MiddleSection.tsx b/client/src/components/parameterPanel/MiddleSection.tsxindex bdf8abde..f66d887f 100644--- a/client/src/components/parameterPanel/MiddleSection.tsx+++ b/client/src/components/parameterPanel/MiddleSection.tsx@@ -34,7 +34,8 @@ const AGENT_WITH_SKILLS_TYPES = ['orchestrator_agent','ai_employee','rlm_agent',- 'claude_code_agent'+ 'claude_code_agent',+ 'deep_agent'];interface ConnectedSkill {diff --git a/client/src/contexts/WebSocketContext.tsx b/client/src/contexts/WebSocketContext.tsxindex b67b42fe..7859e9ba 100644--- a/client/src/contexts/WebSocketContext.tsx+++ b/client/src/contexts/WebSocketContext.tsx@@ -38,7 +38,7 @@ const LONG_RUNNING_NODE_TYPES = ['aiAgent', 'chatAgent', 'rlm_agent','android_agent', 'coding_agent', 'web_agent', 'task_agent', 'social_agent','travel_agent', 'tool_agent', 'productivity_agent', 'payments_agent', 'consumer_agent',- 'autonomous_agent', 'orchestrator_agent', 'ai_employee',+ 'autonomous_agent', 'orchestrator_agent', 'ai_employee', 'deep_agent',];// Status typesdiff --git a/client/src/nodeDefinitions/specializedAgentNodes.ts b/client/src/nodeDefinitions/specializedAgentNodes.tsindex 77777d9f..e2a8f558 100644--- a/client/src/nodeDefinitions/specializedAgentNodes.ts+++ b/client/src/nodeDefinitions/specializedAgentNodes.ts@@ -529,6 +529,34 @@ export const specializedAgentNodes: Record<string, INodeTypeDescription> = {description: 'Working directory for Claude Code (empty = server default)',},],+ },++ // Deep Agent - LangChain DeepAgents powered agent with filesystem, sub-agents, and planning+ deep_agent: {+ displayName: 'Deep Agent',+ name: 'deep_agent',+ icon: '\u{1F9E0}',+ group: ['agent', 'ai'],+ version: 1,+ subtitle: 'LangChain DeepAgents',+ description: 'AI Agent powered by LangChain DeepAgents with built-in filesystem tools (read, write, edit, glob, grep, execute), sub-agent delegation, auto-summarization, and todo planning.',+ defaults: { name: 'Deep Agent', color: dracula.green },+ inputs: [+ ...AI_AGENT_INPUTS,+ { name: 'teammates', displayName: 'Team', type: 'main' as NodeConnectionType, description: 'Connect agents for sub-agent delegation via task tool' }+ ],+ outputs: AI_AGENT_OUTPUTS,+ properties: [+ ...AI_AGENT_PROPERTIES,+ {+ displayName: 'Max Turns',+ name: 'maxTurns',+ type: 'number' as any,+ default: 25,+ typeOptions: { minValue: 1, maxValue: 100 },+ description: 'Maximum agentic loop iterations',+ },+ ],}};@@ -537,4 +565,4 @@ export const specializedAgentNodes: Record<string, INodeTypeDescription> = {// ============================================================================// List of specialized agent node types for identification-export const SPECIALIZED_AGENT_TYPES = ['android_agent', 'coding_agent', 'web_agent', 'task_agent', 'social_agent', 'travel_agent', 'tool_agent', 'productivity_agent', 'payments_agent', 'consumer_agent', 'autonomous_agent', 'orchestrator_agent', 'ai_employee', 'rlm_agent', 'claude_code_agent'];+export const SPECIALIZED_AGENT_TYPES = ['android_agent', 'coding_agent', 'web_agent', 'task_agent', 'social_agent', 'travel_agent', 'tool_agent', 'productivity_agent', 'payments_agent', 'consumer_agent', 'autonomous_agent', 'orchestrator_agent', 'ai_employee', 'rlm_agent', 'claude_code_agent', 'deep_agent'];diff --git a/server/constants.py b/server/constants.pyindex 8776f6e8..d302e69c 100644--- a/server/constants.py+++ b/server/constants.py@@ -37,6 +37,7 @@ AI_AGENT_TYPES: FrozenSet[str] = frozenset(['ai_employee','rlm_agent','claude_code_agent',+ 'deep_agent',])AI_MEMORY_TYPES: FrozenSet[str] = frozenset([diff --git a/server/pyproject.toml b/server/pyproject.tomlindex 045fabf7..4b78edb8 100644--- a/server/pyproject.toml+++ b/server/pyproject.toml@@ -46,6 +46,7 @@ dependencies = ["langchain-groq>=0.2.0","langchain-cerebras>=0.1.0","langgraph>=0.2.0",+ "deepagents>=0.4.12",# Dependency Injection"dependency-injector>=4.40.0",diff --git a/server/requirements.txt b/server/requirements.txtindex 1fde600e..4486ee5c 100644--- a/server/requirements.txt+++ b/server/requirements.txt@@ -51,6 +51,9 @@ langchain-cerebras>=0.1.0# LangGraph - State machine for AI agentslanggraph>=1.0.6+# DeepAgents - Batteries-included agent harness (LangChain)+deepagents>=0.4.12+# Temporal - Durable workflow execution (optional, requires TEMPORAL_ENABLED=true)temporalio>=1.21.1diff --git a/server/services/ai.py b/server/services/ai.pyindex ede6dc4a..f7586d71 100644--- a/server/services/ai.py+++ b/server/services/ai.py@@ -1913,7 +1913,8 @@ class AIService:broadcaster=None,workflow_id: Optional[str] = None,context: Optional[Dict[str, Any]] = None,- database=None) -> Dict[str, Any]:+ database=None,+ node_type: Optional[str] = None) -> Dict[str, Any]:"""Execute Chat Agent - conversational AI with memory, skills, and tool calling.Chat Agent supports:@@ -2121,6 +2122,52 @@ class AIService:thinking_content = Noneiterations = 1+ # Deep Agent: delegate to deepagents package (create_deep_agent)+ # All tools, system_message, and model are already resolved above.+ if node_type == 'deep_agent':+ from deepagents import create_deep_agent++ # Map provider to deepagents model string format+ _da_prefix = {"gemini": "google_genai"}+ model_id = f"{_da_prefix.get(provider, provider)}:{model}"+ max_turns = int(parameters.get('maxTurns', 25))++ agent = create_deep_agent(+ model=model_id,+ tools=all_tools if all_tools else None,+ system_prompt=system_message,+ )++ da_result = await agent.ainvoke(+ {"messages": [{"role": "user", "content": prompt}]},+ config={"recursion_limit": max_turns * 2},+ )++ da_messages = da_result.get("messages", [])+ response_content = ""+ for msg in reversed(da_messages):+ if getattr(msg, "type", None) == "ai" and hasattr(msg, "content"):+ response_content = msg.content if isinstance(msg.content, str) else str(msg.content)+ break++ log_execution_time(logger, "deep_agent", start_time, time.time())+ log_api_call(logger, provider, model, "deep_agent", True)++ return {+ "success": True,+ "node_id": node_id,+ "node_type": "deep_agent",+ "result": {+ "response": response_content,+ "model": model,+ "provider": provider,+ "messages_count": len(da_messages),+ "finish_reason": "stop",+ "timestamp": datetime.now().isoformat(),+ },+ "execution_time": time.time() - start_time,+ }+if all_tools:# Use LangGraph for tool execution (like AI Agent)logger.debug(f"[ChatAgent] Using LangGraph with {len(all_tools)} tools")@@ -2411,6 +2458,7 @@ class AIService:'ai_employee': 'delegate_to_ai_employee','rlm_agent': 'delegate_to_rlm_agent','claude_code_agent': 'delegate_to_claude_code_agent',+ 'deep_agent': 'delegate_to_deep_agent',# Android service nodes (direct tool usage)'batteryMonitor': 'android_battery','networkMonitor': 'android_network',diff --git a/server/services/handlers/ai.py b/server/services/handlers/ai.pyindex 3982e980..5c7e98bf 100644--- a/server/services/handlers/ai.py+++ b/server/services/handlers/ai.py@@ -11,7 +11,7 @@ if TYPE_CHECKING:logger = get_logger(__name__)# Team lead types that can create teams-TEAM_LEAD_TYPES = {'orchestrator_agent', 'ai_employee'}+TEAM_LEAD_TYPES = {'orchestrator_agent', 'ai_employee', 'deep_agent'}async def _collect_agent_connections(@@ -550,7 +550,6 @@ async def handle_chat_agent(})logger.info(f"[Teams] Added {len(teammates)} teammates as delegation tools")- # Standard execution (no team mode)return await ai_service.execute_chat_agent(node_id,parameters,@@ -560,7 +559,8 @@ async def handle_chat_agent(broadcaster=broadcaster,workflow_id=workflow_id,context=context,- database=database+ database=database,+ node_type=node_type,)diff --git a/server/services/handlers/tools.py b/server/services/handlers/tools.pyindex 32436cb3..f492ea67 100644--- a/server/services/handlers/tools.py+++ b/server/services/handlers/tools.py@@ -190,7 +190,7 @@ async def execute_tool(tool_name: str, tool_args: Dict[str, Any],# AI Agent delegation (fire-and-forget async delegation)# Includes specialized agents: android_agent, coding_agent, web_agent, task_agent, social_agent, autonomous_agent- if node_type in ('aiAgent', 'chatAgent', 'android_agent', 'coding_agent', 'web_agent', 'task_agent', 'social_agent', 'travel_agent', 'tool_agent', 'productivity_agent', 'payments_agent', 'consumer_agent', 'autonomous_agent', 'orchestrator_agent', 'ai_employee', 'rlm_agent', 'claude_code_agent'):+ if node_type in ('aiAgent', 'chatAgent', 'android_agent', 'coding_agent', 'web_agent', 'task_agent', 'social_agent', 'travel_agent', 'tool_agent', 'productivity_agent', 'payments_agent', 'consumer_agent', 'autonomous_agent', 'orchestrator_agent', 'ai_employee', 'rlm_agent', 'claude_code_agent', 'deep_agent'):return await _execute_delegated_agent(tool_args, config)# Generic fallback for unknown node typesdiff --git a/server/services/node_executor.py b/server/services/node_executor.pyindex 85d53d4b..8ed1728c 100644--- a/server/services/node_executor.py+++ b/server/services/node_executor.py@@ -138,6 +138,7 @@ class NodeExecutor:'autonomous_agent': partial(handle_chat_agent, ai_service=self.ai_service, database=self.database),'orchestrator_agent': partial(handle_chat_agent, ai_service=self.ai_service, database=self.database),'ai_employee': partial(handle_chat_agent, ai_service=self.ai_service, database=self.database),+ 'deep_agent': partial(handle_chat_agent, ai_service=self.ai_service, database=self.database),'rlm_agent': partial(handle_rlm_agent, ai_service=self.ai_service, database=self.database),'claude_code_agent': partial(handle_claude_code_agent, ai_service=self.ai_service, database=self.database),'simpleMemory': handle_simple_memory,