From aff4bf902dbcd8f59d45cbd50ef44b8920fd8037 Mon Sep 17 00:00:00 2001 From: Arvin A <51036481+DeveloperTheExplorer@users.noreply.github.com> Date: Mon, 13 Apr 2026 19:15:52 +0200 Subject: [PATCH] feat(editor): Add agents sidebar navigation and chat-first builder UX (#28127) Co-authored-by: Claude Opus 4.6 (1M context) --- .../specs/agent-16-and-1-home-and-creation.md | 326 ++++++++++ .claude/specs/agents-q2-scope.md | 169 +++++ .../src/components/N8nIcon/icons.ts | 2 + .../components/N8nIconPicker/IconPicker.vue | 41 +- .../design-system/src/components/index.ts | 1 + .../frontend/@n8n/i18n/src/locales/en.json | 39 ++ .../agents/__tests__/AgentHomeContent.test.ts | 119 ++++ .../__tests__/AgentSettingsSidebar.test.ts | 218 +++++++ .../agents/__tests__/NewAgentView.test.ts | 79 +++ .../agents/__tests__/constants.test.ts | 11 + .../src/features/agents/agents.eventBus.ts | 8 + .../agents/components/AgentChatPanel.vue | 593 +++++++++++------- .../agents/components/AgentCodeEditor.vue | 2 +- .../agents/components/AgentHomeContent.vue | 269 ++++++++ .../components/AgentSettingsSidebar.vue | 467 ++++++++++++++ .../agents/components/AgentToolsPanel.vue | 3 +- .../agents/composables/useAgentApi.ts | 29 +- .../agents/composables/useAgentSchema.ts | 46 -- .../src/features/agents/constants.ts | 1 + .../src/features/agents/module.descriptor.ts | 16 +- .../src/features/agents/provider-mapping.ts | 35 ++ .../agents/views/AgentBuilderView.vue | 406 ++++++------ .../features/agents/views/AgentsListView.vue | 10 + .../features/agents/views/NewAgentView.vue | 249 ++++++++ .../ai/chatHub/components/ModelSelector.vue | 63 +- .../components/AgentActivityTree.vue | 2 +- .../ai/instanceAi/components/ArtifactCard.vue | 2 +- .../projects/components/ProjectHeader.vue | 13 +- .../components/ProjectNavigation.test.ts | 63 ++ .../projects/components/ProjectNavigation.vue | 192 +++++- 30 files changed, 2942 insertions(+), 532 deletions(-) create mode 100644 .claude/specs/agent-16-and-1-home-and-creation.md create mode 100644 .claude/specs/agents-q2-scope.md create mode 100644 packages/frontend/editor-ui/src/features/agents/__tests__/AgentHomeContent.test.ts create mode 100644 packages/frontend/editor-ui/src/features/agents/__tests__/AgentSettingsSidebar.test.ts create mode 100644 packages/frontend/editor-ui/src/features/agents/__tests__/NewAgentView.test.ts create mode 100644 packages/frontend/editor-ui/src/features/agents/__tests__/constants.test.ts create mode 100644 packages/frontend/editor-ui/src/features/agents/agents.eventBus.ts create mode 100644 packages/frontend/editor-ui/src/features/agents/components/AgentHomeContent.vue create mode 100644 packages/frontend/editor-ui/src/features/agents/components/AgentSettingsSidebar.vue delete mode 100644 packages/frontend/editor-ui/src/features/agents/composables/useAgentSchema.ts create mode 100644 packages/frontend/editor-ui/src/features/agents/provider-mapping.ts create mode 100644 packages/frontend/editor-ui/src/features/agents/views/NewAgentView.vue diff --git a/.claude/specs/agent-16-and-1-home-and-creation.md b/.claude/specs/agent-16-and-1-home-and-creation.md new file mode 100644 index 00000000000..610d0f40670 --- /dev/null +++ b/.claude/specs/agent-16-and-1-home-and-creation.md @@ -0,0 +1,326 @@ +# AGENT-16 + AGENT-1: Home Screen & Creation Flow + +**Tickets:** [AGENT-16](https://linear.app/n8n/issue/AGENT-16), [AGENT-1](https://linear.app/n8n/issue/AGENT-1) +**Branch:** `n8n-agents` +**Figma:** https://www.figma.com/design/PeFCNtBUBdtDNonFc9vmqR/Agents-Q2?node-id=0-1&p=f&m=dev + +--- + +## Overview + +These two tickets together transform the agent UX from the current code-editor-centric tabbed layout to the Figma-designed chat-first experience. AGENT-16 covers sidebar navigation and home screen entry points. AGENT-1 covers the agent creation flow and the main agent view (chat + settings sidebar). + +--- + +## Part 1: AGENT-16 — Sidebar & Home Screen + +### What Figma Shows + +**Left sidebar** (see node `115:653`): +- Below "Shared with me", a new **"Agents"** section header with **"New"** badge +- Lists user's agents by name with emoji icons (e.g. "Darwin") +- **"+ New agent"** action at bottom of list +- Agents are visible regardless of which project is selected (cross-project) +- Tooltip/coachmark on first visit: "Create agents that you can chat to, run autonomously, or include in workflows" + +**Home screen** (Overview page): +- "Create agent" available in the top-right **"Create workflow"** dropdown menu +- Agents tab added to project tabs (Workflows, Credentials, Executions, Variables, **Agents**) + +### What Already Exists + +- `ProjectNavigation.vue` — main sidebar with Overview, Personal, Shared, InstanceAI, Chat items +- `ProjectHeader.vue` — already has `ACTION_TYPES.AGENT` + "New Agent" button + dropdown item +- `ProjectTabs.vue` — dynamic tabs via `additionalTabs` prop from module descriptors +- `module.descriptor.ts` — agents module already registers "Agents" tab in `projectTabs.overview` and `projectTabs.project` +- `settingsStore.isModuleActive('agents')` — feature flag gate already used in ProjectHeader +- `listAllAgents` API — `GET /agents/v2?all=true` returns cross-project agent list + +### What Needs to Change + +#### 1.1 PostHog feature flag gating + +**File:** `packages/frontend/editor-ui/src/app/moduleInitializer/moduleInitializer.ts` + +The `agents` module registration should be gated behind PostHog flag `0XX_first_class_agents` (confirm index with team). When the flag is off, the module isn't registered, `settingsStore.isModuleActive('agents')` returns false, and all UI (sidebar, tabs, create button) is hidden. + +#### 1.2 Add Agents section to `ProjectNavigation.vue` + +**File:** `packages/frontend/editor-ui/src/features/collaboration/projects/components/ProjectNavigation.vue` + +Add between the Instance AI / Chat items and the "Projects" label: + +``` +"Agents" section header with "New" badge +├── Agent 1 (icon + name) → navigates to agent builder +├── Agent 2 (icon + name) +└── + New agent → navigates to new agent creation page +``` + +Implementation: +- Add computed `isAgentsAvailable` gated on `settingsStore.isModuleActive('agents')` +- Add computed `agentsList` that calls `listAllAgents` (fetched on mount, cached in a local ref) +- Render a section with `N8nText` header "Agents" + `N8nTag` "New" badge +- Map agents to `N8nMenuItem` items with route to `AGENT_BUILDER_VIEW` +- Add "+ New agent" item that routes to the new agent creation page (new route, see Part 2) +- Active state: highlight when current route is an agent builder with matching agentId + +#### 1.3 Coachmark tooltip + +- On first display of the Agents section, show a tooltip/popover: "Create agents that you can chat to, run autonomously, or include in workflows" +- Gate on a localStorage flag (e.g. `n8n_agents_coachmark_dismissed`) +- Use existing `useN8nLocalStorage` composable for persistence +- Dismiss on click or after navigating to an agent + +#### 1.4 No changes needed (already done) + +- "New Agent" in ProjectHeader create dropdown +- Agents tab in ProjectTabs (via module descriptor) +- Feature flag gating + +--- + +## Part 2: AGENT-1 — Creation Flow & Agent View Redesign + +### What Figma Shows + +**A. "New agent" page** (nodes `115:1350`, `115:4136`): +- Header: "New agent" title, **"Create blank"** button top-right +- Center content: "Let's build something, [Name]" heading +- Text input: "Describe what you're working on..." with mic + send buttons +- Below input: **"Suggestions"** section with 3 template cards: + - Each card: emoji icon + bold name + description + tool icons on right + - e.g. "SEO Audit", "Recruiting Sourcer", "Inbox Sorter" +- Submitting a description → uses the AI builder to create the agent (existing `POST /build` endpoint) + +**B. Agent home/chat view** (node `6:193`): +- **3-column layout**: left sidebar (app nav) | center (chat) | right (settings) +- Top bar: agent icon + "Sales Agent" name, settings toggle + activity toggle icons +- Center column: + - Agent icon (large) + name + "Add a description here" subtitle + - Chat input: "Send a message..." with attachment, mic, send buttons + - **"Recent"** section: list of past sessions with source icon + title + preview + timestamp +- Right column (**Settings sidebar**, toggled via icon): + - "Settings" header with Cancel + Save buttons + - "Unsaved changes" indicator + - **Model**: provider icon + model name + credential, with dropdown + - **Instructions**: text area with agent system prompt + - **Triggers** (collapsible): n8n Chat, Slack Mention, Schedule, Workflow — with "+" to add + - **Tools** (collapsible): list of tools with credential names, "+" to add, warning state for missing creds + - **Advanced** (collapsible): memory config, guardrails toggles, delete agent + +**C. Agent chat conversation** (node `14:319`): +- Breadcrumb: "Sales Agent > Biggest churn risk" +- User messages right-aligned, agent messages left-aligned +- Tool calls: collapsible "5 tool calls" with list (icon + "Service → Action description") +- Message actions: copy, retry, more (...) +- Chat input pinned to bottom + +### What Already Exists + +- `AgentBuilderView.vue` — current tabbed layout: left sidebar (Code/Overview/Tools/Prompts/Memory/Evals/Integrations) + center panel + right chat panel +- `AgentChatPanel.vue` — SSE streaming chat with tool call display (functional) +- `AgentOverviewPanel.vue` — model selector, credential picker, instructions editor +- `AgentToolsPanel.vue` — tool management with workflow tools +- `AgentSidebar.vue` — left tab navigation (code-first tabs) +- All backend APIs for chat, schema, tools, integrations already exist + +### What Needs to Change + +#### 2.1 New route: Agent creation page + +**File:** `packages/frontend/editor-ui/src/features/agents/module.descriptor.ts` + +Add a new route: +```typescript +{ + name: 'NEW_AGENT', + path: '/new-agent', + component: NewAgentView, + meta: { middleware: ['authenticated', 'custom'] }, +} +``` + +**File:** `packages/frontend/editor-ui/src/features/agents/constants.ts` + +Add: `export const NEW_AGENT_VIEW = 'new-agent';` + +#### 2.2 New view: `NewAgentView.vue` + +**File:** `packages/frontend/editor-ui/src/features/agents/views/NewAgentView.vue` + +Layout: +- Uses the standard app layout (with main sidebar visible) +- Top bar: "New agent" title left, "Create blank" button right +- Center content (vertically centered, max-width ~600px): + - Heading: "Let's build something, [firstName]" (from `useUsersStore().currentUser`) + - Text area input: placeholder "Describe what you're working on...", mic button, send button + - "Suggestions" label + - 3 suggestion cards (hardcoded for P0, ties into AGENT-15): + - Icon + name (bold) + description + tool count icons + - Click → populates the text input with a pre-written prompt + +Behavior: +- **"Create blank"** button: calls `createAgent()` API, navigates to `AGENT_BUILDER_VIEW` +- **Submit description**: calls `createAgent()`, then navigates to `AGENT_BUILDER_VIEW` with a query param like `?prompt=...` so the builder can auto-trigger the build endpoint +- **Click suggestion**: populates input, user can edit + submit + +#### 2.3 Redesign `AgentBuilderView.vue` — chat-first layout + +**File:** `packages/frontend/editor-ui/src/features/agents/views/AgentBuilderView.vue` + +Current layout: +``` +[AgentSidebar (tabs)] [Center (code/overview/tools/...)] [AgentChatPanel] +``` + +New layout (matching Figma): +``` +[Center: Agent home + Chat] [Settings sidebar (togglable)] +``` + +Changes: +- Remove `AgentSidebar` (tab navigation) from the agent builder view +- Center column becomes the **chat-first view**: + - Agent header: icon + name (editable) + description (editable) + - Chat input (reuse `AgentChatPanel` internals or `ChatInputBase`) + - Recent sessions list (below chat input when no conversation is active) + - When in conversation: full chat thread replaces the home content +- Right column becomes the **Settings sidebar** (new component): + - Toggle visibility via header icons (settings icon + activity icon) + - Scrollable panel with all settings sections + +Top bar: +- Left: agent icon + agent name (as breadcrumb: "Sales Agent" or "Sales Agent > Session title") +- Right: settings toggle icon, activity toggle icon + +#### 2.4 New component: `AgentSettingsSidebar.vue` + +**File:** `packages/frontend/editor-ui/src/features/agents/components/AgentSettingsSidebar.vue` + +A right-hand panel (~340px wide) containing all agent configuration in a single scrollable view: + +| Section | Content | Existing component to reuse | +|---------|---------|---------------------------| +| Header | "Settings" + Cancel/Save buttons + "Unsaved changes" | New | +| Model | Provider + model dropdown + credential picker | `AgentOverviewPanel` (extract model/credential parts) | +| Instructions | Text area for system prompt | `AgentOverviewPanel` (extract instructions part) | +| Triggers | Collapsible list + "+" button | New (P0: just list, no inline config) | +| Tools | Collapsible list with credential status + "+" button | `AgentToolsPanel` (simplified view) | +| Advanced | Collapsible: memory, guardrails, delete | `AgentMemoryPanel` parts, new guardrails toggles | +| Code | Collapsible accordion (collapsed by default), Monaco editor | `AgentCodeEditor` (existing) | + +Behavior: +- Tracks local changes, shows "Unsaved changes" indicator +- Save: calls `patchAgentSchema()` + `updateAgent()` as needed +- Cancel: reverts to last-saved state + +#### 2.5 New component: `AgentHomeContent.vue` + +**File:** `packages/frontend/editor-ui/src/features/agents/components/AgentHomeContent.vue` + +The center content when no chat session is active: +- Large agent icon (centered) +- Agent name (editable on click) +- "Add a description here" subtitle (editable on click) +- Chat input (`ChatInputBase` with attachment, mic, send) +- "Recent" section header with list/grid toggle icon +- Recent sessions list (each item: source icon + title + preview text + timestamp) + +Note: Recent sessions requires a new API endpoint. For P0 MVP, this can show an empty state or be omitted if the sessions API isn't ready (depends on AGENT-9). + +#### 2.6 Update `AgentChatPanel.vue` for inline use + +Currently `AgentChatPanel` is a right-side panel. It needs to work as the center content when a conversation is active. Refactor to: +- Extract chat message thread into a reusable `AgentChatThread.vue` +- `AgentChatPanel` becomes a wrapper that can render in center-column mode (full width) vs. the old side-panel mode +- Add breadcrumb support in the top bar (agent name > session title) + +#### 2.7 Update `ProjectHeader.vue` — "New Agent" action + +Currently "New Agent" in the dropdown creates a blank agent and navigates to builder. Change to navigate to `NEW_AGENT_VIEW` instead, so users see the creation flow. + +**File:** `packages/frontend/editor-ui/src/features/collaboration/projects/components/ProjectHeader.vue` + +```typescript +[ACTION_TYPES.AGENT]: () => { + void router.push({ name: NEW_AGENT_VIEW }); +}, +``` + +--- + +## File Changes Summary + +| Action | File | Description | +|--------|------|-------------| +| Modify | `ProjectNavigation.vue` | Add Agents section with list + coachmark | +| Create | `views/NewAgentView.vue` | "Let's build something" creation page | +| Create | `components/AgentSettingsSidebar.vue` | Right-hand settings panel | +| Create | `components/AgentHomeContent.vue` | Agent home (icon, chat input, recent) | +| Modify | `views/AgentBuilderView.vue` | Redesign to chat-first 2-column layout | +| Modify | `components/AgentChatPanel.vue` | Refactor for center-column use | +| Modify | `module.descriptor.ts` | Add NEW_AGENT route | +| Modify | `constants.ts` | Add NEW_AGENT_VIEW constant | +| Modify | `ProjectHeader.vue` | Route "New Agent" to creation page | +| Modify | `AgentOverviewPanel.vue` | Extract model/instructions for reuse in settings sidebar | + +--- + +## Implementation TODO + +### AGENT-16: Sidebar & Home Screen +- [ ] Gate agents module registration behind PostHog flag `0XX_first_class_agents` in `moduleInitializer.ts` +- [x] Add `isAgentsAvailable` computed + agent list fetch to `ProjectNavigation.vue` +- [x] Render Agents section header with "New" badge +- [x] Render agent list items with icons + names + navigation (global, cross-project) +- [x] Add "+ New agent" item routing to creation page +- [x] Add coachmark tooltip with localStorage dismissal +- [x] Active state highlighting for current agent + +### AGENT-1: Creation Flow +- [x] Add `NEW_AGENT_VIEW` constant and route in module descriptor +- [x] Create `NewAgentView.vue` with heading, input, suggestions, "Create blank" +- [x] Hardcode 3 suggestion templates (SEO Audit, Recruiting Sourcer, Inbox Sorter) +- [x] "Create blank" creates agent + navigates to builder +- [x] Submit description creates agent + navigates to builder with prompt param +- [x] Update ProjectHeader to route "New Agent" action to creation page + +### AGENT-1: Agent View Redesign +- [x] Create `AgentSettingsSidebar.vue` with Model, Instructions, Triggers, Tools, Advanced, Code sections +- [x] Code section: collapsible accordion (collapsed by default) wrapping `AgentCodeEditor` +- [x] Create `AgentHomeContent.vue` with agent icon/name/description + chat input + recent sessions placeholder +- [x] Recent sessions: show "No conversations yet" empty state +- [x] Redesign `AgentBuilderView.vue` to 2-column layout (center chat + right settings) +- [x] Add top bar with agent name, settings toggle, activity toggle — split header pattern (each column has own 56px header) +- [x] Refactor `AgentChatPanel.vue` for center-column rendering (inline mode) +- [x] ~~Extract reusable parts from `AgentOverviewPanel`~~ → Built model/instructions/credential directly in sidebar using ChatHub patterns (CredentialIcon, PROVIDER_CREDENTIAL_TYPE_MAP, credential setup flow) +- [x] Wire Save/Cancel in settings sidebar to schema API +- [x] Add "Unsaved changes" tracking (dirty state lifted to parent view) + +### Additional work completed (not in original plan) +- [x] Dynamic provider list from `chatHubLLMProviderSchema` (not hardcoded) +- [x] Provider icons via `CredentialIcon` + `PROVIDER_CREDENTIAL_TYPE_MAP` (not copied SVGs) +- [x] ChatHub-style credential setup: auto-select single credential, open selector modal or creation modal +- [x] Model dropdown disabled when no credential is set +- [x] Provider ↔ catalog ID mapping (ChatHub camelCase ↔ SDK lowercase) +- [x] All static text uses i18n (30 keys in en.json) +- [x] CSS uses proper design tokens (`--background--surface`, `--background--surface--hover`) +- [x] Unit tests: constants, provider mapping, NewAgentView render + +### Deferred (not blocking P0 launch) +- [ ] Recent sessions list (needs AGENT-9 execution logging API) +- [ ] Activity sidebar (Agent ID, Session ID, context, cost) +- [ ] Trigger inline configuration (n8n Chat, Schedule — Slack already works) +- [ ] Tool config modals (Slack channels, Workflow config) +- [ ] Breadcrumb navigation for chat sessions +- [ ] PostHog feature flag gating (needs backend + flag index confirmed with team) + +--- + +## Decisions + +1. **Agents in sidebar — global.** The sidebar shows all agents across all projects via `?all=true` API. The "Agents" tab within a project view shows only that project's agents (project-scoped via `listAgents`). +2. **Feature flag — PostHog `0XX_first_class_agents`.** A PostHog experiment flag controls whether the `agents` module is registered in `moduleInitializer.ts`. The `settingsStore.isModuleActive('agents')` gate stays as the UI-level check — it'll be falsy when the module isn't registered. The exact index prefix (e.g. `025`, `026`) should be confirmed with the team before implementation. +3. **Recent sessions — placeholder.** Show the "Recent" section header with an empty state: "No conversations yet — send a message to get started." This preserves layout structure and will be wired to real data when AGENT-9 lands. +4. **Code editor — collapsed accordion.** Keep the Monaco code editor accessible in the settings sidebar as a collapsible "Code" accordion section, collapsed by default. Will be hidden/removed closer to P0 release. diff --git a/.claude/specs/agents-q2-scope.md b/.claude/specs/agents-q2-scope.md new file mode 100644 index 00000000000..42e5995f9ce --- /dev/null +++ b/.claude/specs/agents-q2-scope.md @@ -0,0 +1,169 @@ +# Agents Q2 — Project Scope + +**Branch:** `n8n-agents` +**Linear:** https://linear.app/n8n/project/agents-as-first-class-citizen-3bfa6b1e2bb8 +**Figma:** https://www.figma.com/design/PeFCNtBUBdtDNonFc9vmqR/Agents-Q2?node-id=0-1&p=f&m=dev +**Target:** 2026-04-27 +**Team:** Agent (Yehor Kardash lead) + +## P0 Objectives + +- Learn what agents users build to expand framework capabilities +- Nail down agent building UX +- MVP: create agents as first-class citizens, connect workflows as tools, invoke from within (workflows) and outside (chat) n8n +- Release: experiment to 5% cloud users (and/or self-hosted) + +--- + +## P0 Linear Tickets + +| Ticket | Title | Status | Assignee | Branch impl? | +|--------|-------|--------|----------|--------------| +| AGENT-1 | Creation flow UI | Ready for pick up | — | Partial (list + builder views exist, but not Figma design) | +| AGENT-2 | Integrate agent builder with InstanceAI | Ready for pick up | — | Partial (BuilderCard exists) | +| AGENT-3 | Agent <-> JSON conversion | Review | Yehor | Done (schema introspection + fromSchema + code gen) | +| AGENT-4 | Run agent code in sandbox for JSON schema | Review | Michael Drury | Done (AgentSecureRuntime + describeSecurely) | +| AGENT-5 | Allow running nodes as tools | In Progress | Yehor | Not yet | +| AGENT-6 | Allow running workflows as tools | Review | Yehor | Done (WorkflowToolFactory) | +| AGENT-7 | Chat integrations and triggers | Ready for pick up | — | Partial (Slack done, n8n Chat + Schedule not yet) | +| AGENT-8 | Default agent memory | In Progress | Yehor | Partial (N8NCheckpointStorage exists, full N8nMemory TBD) | +| AGENT-9 | Agent execution logging | Ready for pick up | — | Not yet | +| AGENT-10 | Support top N LLM providers | Ready for pick up | — | Partial (model catalog API exists, UI picker exists) | +| AGENT-11 | Top N memory integrations (Postgres, Redis) | Ready for pick up | — | Not yet | +| AGENT-12 | Agent evals | Ready for pick up | — | Partial (UI panel exists, backend eval runner TBD) | +| AGENT-13 | Create Agent node (workflow) | Ready for pick up | — | Not yet | +| AGENT-14 | "create-tool" tool | Ready for pick up | — | Not yet | +| AGENT-15 | Hardcoded starter templates | Ready for pick up | — | Not yet | +| AGENT-16 | Update home screen | Ready for pick up | — | Partial (agents tab in project header, not full sidebar) | +| AGENT-17 | Memory analysis / footprint | Parked | — | Not yet | + +**Progress: ~7% (per Linear milestone)** + +--- + +## Full Figma Scope (3 sections) + +### 1. Using the Agent +- Left sidebar: "Agents" section with list + "+ New agent" +- Agent home: icon, name, description, chat input, recent sessions with source icons + timestamps +- Chat view: breadcrumb nav, user/agent messages, collapsible tool calls, message actions (copy/retry/more) +- Settings sidebar (right panel): Model picker, instructions, triggers (n8n Chat/Slack/Schedule), tools list with credentials, advanced section, cancel/save with unsaved indicator +- Activity sidebar: Agent ID, Session ID, model, context usage (tokens/%), cost +- Tools modal: search, connected tools with status, available tools catalog, per-tool gear +- Tool config modals: Slack (credential + channel picker), Workflow (workflow + trigger + message), generic pattern +- Workflow node: "Custom Agent" node in canvas with agent dropdown + prompt + +### 2. Creating an Agent +- Via InstanceAI: chat-based creation, progress steps, agent card on completion +- Via "+ New agent": "Let's build something" landing, description input, suggestion cards (SEO Audit, Recruiting Sourcer, etc.), "Create blank" option + +### 3. View Agent Session (WIP in Figma) +- Read-only session review with full tool call history + +--- + +## What's Been Implemented + +### Backend (`packages/cli/src/modules/agents/`) + +**DB:** `agents` table (id, name, code, description, projectId, credentialId, provider, model, integrations JSON, schema JSON) + `agent_checkpoints` table + +**API** (`/projects/:projectId/agents/v2`): +- CRUD: POST/GET/PATCH/DELETE agents +- GET `/:agentId/schema` / PATCH `/:agentId/schema` — introspect + update +- GET `/:agentId/credentials` — list user credentials +- GET `/catalog/models` — LLM provider/model catalog +- POST `/:agentId/chat` — SSE streaming chat execution +- POST `/:agentId/build` — SSE streaming AI builder (code generation) +- POST `/:agentId/integrations/connect|disconnect`, GET `/status` — Slack integration +- POST `/:agentId/webhooks/:platform` — inbound Slack webhooks + +**Services:** +- `AgentsService` — CRUD, runtime caching (TTL 30m), schema caching (TTL 10m), `executeForChat()`, `resumeForChat()`, `compileIsolated()` +- `AgentsBuilderService` — AI builds/modifies agent code via streaming +- `AgentSecureRuntime` — sandboxed user code execution +- `WorkflowToolFactory` — n8n workflows as agent tools (chat/manual/schedule/form/executeWorkflow triggers) +- `ChatIntegrationService` — Slack Chat SDK lifecycle, webhook routing +- `AgentChatBridge` — Chat SDK mentions → agent execution, rich interactions +- `ComponentMapper` — tool-call suspensions → Slack Block Kit +- `N8NCheckpointStorage` — conversation state persistence +- `generate-agent-code.ts` — schema ↔ code round-trip + +### SDK (`packages/@n8n/agents/`) +- `Agent.fromSchema()` — reconstruct agent from persisted schema +- Schema introspection (describe agent → `AgentSchema`) +- Provider capabilities / model catalog +- Credential provider interface + +### Frontend (`packages/frontend/editor-ui/src/features/agents/`) + +**Routes:** `/home/agents`, `/projects/:projectId/agents`, `/projects/:projectId/agents/:agentId` + +**Views:** +- `AgentsListView` — list with sort/create/delete +- `AgentBuilderView` — tabbed builder (code, overview, tools, prompts, memory, evals, integrations) + chat panel + +**Components:** +- `AgentChatPanel` — SSE streaming chat with tool call display +- `AgentCodeEditor` — Monaco TypeScript editor +- `AgentOverviewPanel` — model/credential/instructions/description +- `AgentToolsPanel` — add/remove/configure tools + workflow tools +- `AgentPromptsPanel` — system prompt editing +- `AgentMemoryPanel` — memory config (last messages, semantic recall, working memory) +- `AgentEvalsPanel` — evaluation setup +- `AgentIntegrationsPanel` — Slack connect/disconnect +- `AgentSidebar` — tab navigation +- `AgentListItem`, `AgentMiniEditor` + +**API composables:** `useAgentApi`, `useAgentSchema`, `useModelCatalog` + +### Other +- InstanceAI: `BuilderCard` for agent creation in InstanceAI chat +- `ProjectHeader` modified for agents tab +- Slack OAuth2 credential updates +- `@n8n/config` agents config +- `@n8n/decorators` route options for SSE/webhooks + +--- + +## P0 Gap Analysis — What's Left + +### Must Build + +| Area | Tickets | Details | +|------|---------|---------| +| **Creation flow UI** | AGENT-1, AGENT-16 | "New agent" landing page, sidebar nav with agents section, agent home screen (chat-first) | +| **Nodes as tools** | AGENT-5 | Run n8n nodes as agent tools via @n8n/workflow-sdk | +| **Chat integrations + triggers** | AGENT-7 | n8n Chat trigger, Schedule trigger (Slack already done) | +| **Default memory** | AGENT-8 | Full N8nMemory for DB-backed memory (checkpoint storage exists but not full memory) | +| **Execution logging** | AGENT-9 | Agent execution history, similar to workflow executions | +| **LLM providers** | AGENT-10 | Expand provider support beyond current catalog | +| **Agent node** | AGENT-13 | "Custom Agent" workflow node: agent dropdown + prompt | +| **"create-tool" tool** | AGENT-14 | Search tool registry, create tools on the fly | +| **Starter templates** | AGENT-15 | Hardcoded agent templates for onboarding | +| **InstanceAI integration** | AGENT-2 | Full InstanceAI subagent for agent creation | + +### Lower Priority P0 + +| Area | Tickets | Details | +|------|---------|---------| +| **Memory integrations** | AGENT-11 | Postgres, Redis, etc. memory backends | +| **Evals** | AGENT-12 | Agent evaluation framework | +| **Memory footprint** | AGENT-17 | Performance analysis (parked) | + +### In Review (nearly done) + +| Tickets | Details | +|---------|---------| +| AGENT-3 | Agent <-> JSON conversion (schema introspection, fromSchema, code gen) | +| AGENT-4 | Sandbox schema generation (AgentSecureRuntime) | +| AGENT-6 | Workflows as tools (WorkflowToolFactory) | + +### Already Solid (no major changes needed) + +- Backend CRUD + streaming API +- Agent SDK (schema introspection, fromSchema, code generation) +- Slack integration plumbing (webhooks, Chat SDK bridge, checkpoint storage) +- Workflow-as-tool resolution +- AI builder (streaming code generation) +- Chat execution with tool calls diff --git a/packages/frontend/@n8n/design-system/src/components/N8nIcon/icons.ts b/packages/frontend/@n8n/design-system/src/components/N8nIcon/icons.ts index f9dda6cab0c..154402dce16 100644 --- a/packages/frontend/@n8n/design-system/src/components/N8nIcon/icons.ts +++ b/packages/frontend/@n8n/design-system/src/components/N8nIcon/icons.ts @@ -160,6 +160,7 @@ import IconLucideMaximize from '~icons/lucide/maximize'; import IconLucideMaximize2 from '~icons/lucide/maximize-2'; import IconLucideMenu from '~icons/lucide/menu'; import IconLucideMessageCircle from '~icons/lucide/message-circle'; +import IconLucideMessageCirclePlus from '~icons/lucide/message-circle-plus'; import IconLucideMessageSquare from '~icons/lucide/message-square'; import IconLucideMessageSquarePlus from '~icons/lucide/message-square-plus'; import IconLucideMessagesSquare from '~icons/lucide/messages-square'; @@ -628,6 +629,7 @@ export const updatedIconSet = { 'message-circle': IconLucideMessageCircle, 'message-square': IconLucideMessageSquare, 'message-square-plus': IconLucideMessageSquarePlus, + 'message-circle-plus': IconLucideMessageCirclePlus, 'messages-square': IconLucideMessagesSquare, mic: IconLucideMic, milestone: IconLucideMilestone, diff --git a/packages/frontend/@n8n/design-system/src/components/N8nIconPicker/IconPicker.vue b/packages/frontend/@n8n/design-system/src/components/N8nIconPicker/IconPicker.vue index 082b903b916..723d440fd32 100644 --- a/packages/frontend/@n8n/design-system/src/components/N8nIconPicker/IconPicker.vue +++ b/packages/frontend/@n8n/design-system/src/components/N8nIconPicker/IconPicker.vue @@ -40,8 +40,12 @@ const emojiRanges = [ type Props = { buttonTooltip: string; - buttonSize?: 'small' | 'large'; + buttonSize?: 'small' | 'large' | 'xlarge'; isReadOnly?: boolean; + /** Additional CSS class(es) for the outer container element */ + containerClass?: string | Record | Array>; + /** Additional CSS class(es) for the trigger button */ + buttonClass?: string | Record | Array>; }; const { t } = useI18n(); @@ -166,11 +170,14 @@ async function loadEmojiMetadataMap() {