/* ┌──────────────────────────────────────────────────────────────────────────────┐ │ @author: Davidson Gomes │ │ @file: /app/agents/workflows/nodes/components/agent/AgentNode.tsx │ │ Developed by: Davidson Gomes │ │ Creation date: May 13, 2025 │ │ Contact: contato@evolution-api.com │ ├──────────────────────────────────────────────────────────────────────────────┤ │ @copyright © Evolution API 2025. All rights reserved. │ │ Licensed under the Apache License, Version 2.0 │ │ │ │ You may not use this file except in compliance with the License. │ │ You may obtain a copy of the License at │ │ │ │ http://www.apache.org/licenses/LICENSE-2.0 │ │ │ │ Unless required by applicable law or agreed to in writing, software │ │ distributed under the License is distributed on an "AS IS" BASIS, │ │ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. │ │ See the License for the specific language governing permissions and │ │ limitations under the License. │ ├──────────────────────────────────────────────────────────────────────────────┤ │ @important │ │ For any future changes to the code in this file, it is recommended to │ │ include, together with the modification, the information of the developer │ │ who changed it and the date of modification. │ └──────────────────────────────────────────────────────────────────────────────┘ */ /* eslint-disable no-unused-vars */ /* eslint-disable @typescript-eslint/no-explicit-any */ import { Handle, NodeProps, Position, useEdges } from "@xyflow/react"; import { MessageCircle, User, Code, ExternalLink, Workflow, GitBranch, RefreshCw, BookOpenCheck, ArrowRight } from "lucide-react"; import { Agent } from "@/types/agent"; import { Badge } from "@/components/ui/badge"; import { cn } from "@/lib/utils"; import { BaseNode } from "../../BaseNode"; export function AgentNode(props: NodeProps) { const { selected, data } = props; const edges = useEdges(); const isHandleConnected = (handleId: string) => { return edges.some( (edge) => edge.source === props.id && edge.sourceHandle === handleId ); }; const isBottomHandleConnected = isHandleConnected("bottom-handle"); const agent = data.agent as Agent | undefined; const isExecuting = data.isExecuting as boolean | undefined; const getAgentTypeName = (type: string) => { const agentTypes: Record = { llm: "LLM Agent", a2a: "A2A Agent", sequential: "Sequential Agent", parallel: "Parallel Agent", loop: "Loop Agent", workflow: "Workflow Agent", task: "Task Agent", }; return agentTypes[type] || type; }; const getAgentTypeIcon = (type: string) => { switch (type) { case "llm": return ; case "a2a": return ; case "sequential": return ; case "parallel": return ; case "loop": return ; case "workflow": return ; case "task": return ; default: return ; } }; const getModelBadgeColor = (model: string) => { if (model?.includes('gpt-4')) return 'bg-green-900/30 text-green-400 border-green-600/30'; if (model?.includes('gpt-3')) return 'bg-yellow-900/30 text-yellow-400 border-yellow-600/30'; if (model?.includes('claude')) return 'bg-orange-900/30 text-orange-400 border-orange-600/30'; if (model?.includes('gemini')) return 'bg-blue-900/30 text-blue-400 border-blue-600/30'; return 'bg-neutral-800 text-neutral-400 border-neutral-600/50'; }; return (

{data.label as string}

{agent ? (
{getAgentTypeIcon(agent.type)} {agent.name}
{getAgentTypeName(agent.type)}
{agent.model && (
{agent.model}
)} {agent.description && (

{agent.description.slice(0, 30)} {agent.description.length > 30 && '...'}

)}
) : (

Select an agent

Click to configure

)}
Next step
); }