import React from 'react'; import { Settings, Wrench, Server, BookOpen, Workflow, Zap } from 'lucide-react'; import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/ui/accordion'; import { ExpandableMarkdownEditor } from '@/components/ui/expandable-markdown-editor'; import { AgentToolsConfiguration } from '../agent-tools-configuration'; import { AgentMCPConfiguration } from '../agent-mcp-configuration'; import { AgentKnowledgeBaseManager } from '../knowledge-base/agent-knowledge-base-manager'; import { AgentWorkflowsConfiguration } from '../workflows/agent-workflows-configuration'; import { AgentTriggersConfiguration } from '../triggers/agent-triggers-configuration'; import { toast } from 'sonner'; import { KortixLogo } from '../../sidebar/kortix-logo'; interface ConfigurationTabProps { agentId: string; displayData: { name: string; description: string; system_prompt: string; agentpress_tools: any; configured_mcps: any[]; custom_mcps: any[]; is_default: boolean; avatar: string; avatar_color: string; }; versionData?: { version_id: string; configured_mcps: any[]; custom_mcps: any[]; system_prompt: string; agentpress_tools: any; }; isViewingOldVersion: boolean; onFieldChange: (field: string, value: any) => void; onMCPChange: (updates: { configured_mcps: any[]; custom_mcps: any[] }) => void; initialAccordion?: string; agentMetadata?: { is_suna_default?: boolean; centrally_managed?: boolean; restrictions?: { system_prompt_editable?: boolean; tools_editable?: boolean; name_editable?: boolean; description_editable?: boolean; mcps_editable?: boolean; }; }; } export function ConfigurationTab({ agentId, displayData, versionData, isViewingOldVersion, onFieldChange, onMCPChange, initialAccordion, agentMetadata, }: ConfigurationTabProps) { const isSunaAgent = agentMetadata?.is_suna_default || false; const mapAccordion = (val?: string) => { if (val === 'instructions') return 'system'; if (isSunaAgent && (val === 'system' || val === 'tools')) { return 'integrations'; } if (['system', 'tools', 'integrations', 'knowledge', 'workflows', 'triggers'].includes(val || '')) { return val!; } return isSunaAgent ? 'integrations' : 'system'; }; const [openAccordion, setOpenAccordion] = React.useState(mapAccordion(initialAccordion)); React.useEffect(() => { if (initialAccordion) { setOpenAccordion(mapAccordion(initialAccordion)); } }, [initialAccordion]); const restrictions = agentMetadata?.restrictions || {}; const isSystemPromptEditable = !isViewingOldVersion && (restrictions.system_prompt_editable !== false); const areToolsEditable = !isViewingOldVersion && (restrictions.tools_editable !== false); const areMCPsEditable = !isViewingOldVersion && (restrictions.mcps_editable !== false); const handleSystemPromptChange = (value: string) => { if (!isSystemPromptEditable && isSunaAgent) { toast.error("System prompt cannot be edited", { description: "Suna's system prompt is managed centrally and cannot be changed.", }); return; } onFieldChange('system_prompt', value); }; return (
{isSunaAgent && (
Suna Default Agent

This is Suna's default agent with centrally managed system prompt and tools. You can customize integrations, knowledge base, workflows, and triggers to personalize your experience.

)} {!isSunaAgent && (

System Prompt

Define agent behavior and goals

)} {!isSunaAgent && (

Default Tools

Configure default agentpress tools

onFieldChange('agentpress_tools', tools) : () => {}} disabled={!areToolsEditable} isSunaAgent={isSunaAgent} />
)}

Integrations

Connect external services via MCPs

Knowledge Base

Upload and manage knowledge for the agent

Workflows

Automate complex processes

Triggers

Set up automated agent runs

); }