Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
🪚 chore: Deprecate Agent Chain Authoring (#16745)
lia-by-librechat[bot]af35fe54390c
diff --git a/api/server/services/__tests__/ToolService.spec.js b/api/server/services/__tests__/ToolService.spec.jsindex 52cf1798b7..c4df4cb7bd 100644--- a/api/server/services/__tests__/ToolService.spec.js+++ b/api/server/services/__tests__/ToolService.spec.js@@ -3888,7 +3888,7 @@ describe('ToolService - Action Capability Gating', () => {expect(defaultAgentCapabilities).toContain(AgentCapabilities.context);expect(defaultAgentCapabilities).toContain(AgentCapabilities.ask_user_question);expect(defaultAgentCapabilities).toContain(AgentCapabilities.tools);- expect(defaultAgentCapabilities).toContain(AgentCapabilities.chain);+ expect(defaultAgentCapabilities).not.toContain(AgentCapabilities.chain);expect(defaultAgentCapabilities).toContain(AgentCapabilities.ocr);});});diff --git a/client/src/components/SidePanel/Agents/Advanced/AdvancedPanel.tsx b/client/src/components/SidePanel/Agents/Advanced/AdvancedPanel.tsxindex 8729543a84..417ba2117d 100644--- a/client/src/components/SidePanel/Agents/Advanced/AdvancedPanel.tsx+++ b/client/src/components/SidePanel/Agents/Advanced/AdvancedPanel.tsx@@ -1,6 +1,5 @@import { useState } from 'react';import { ChevronLeft, Check, Copy } from 'lucide-react';-import { AgentCapabilities } from 'librechat-data-provider';import { Controller, useFormContext } from 'react-hook-form';import { Button, TooltipAnchor, labelVariants, useToastContext } from '@librechat/client';import type { AgentForm } from '~/common';@@ -16,9 +15,10 @@ export default function AdvancedPanel() {const { showToast } = useToastContext();const { watch, control } = useFormContext<AgentForm>();const currentAgentId = watch('id');+ const chainIds = watch('agent_ids');const [copied, setCopied] = useState(false);- const { setActivePanel, agentsConfig } = useAgentPanelContext();+ const { setActivePanel } = useAgentPanelContext();const handleCopyAgentId = async () => {if (!currentAgentId) return;@@ -59,7 +59,7 @@ export default function AdvancedPanel() {<MaxAgentSteps /></section>- {agentsConfig?.capabilities.includes(AgentCapabilities.chain) && (+ {(chainIds?.length ?? 0) > 0 && (<Controllername="agent_ids"control={control}diff --git a/client/src/components/SidePanel/Agents/Advanced/AgentChain.tsx b/client/src/components/SidePanel/Agents/Advanced/AgentChain.tsxindex 9744a8f8c1..7674288379 100644--- a/client/src/components/SidePanel/Agents/Advanced/AgentChain.tsx+++ b/client/src/components/SidePanel/Agents/Advanced/AgentChain.tsx@@ -1,16 +1,9 @@-import React, { useState, useMemo, useEffect } from 'react';-import { Link2, ListOrdered } from 'lucide-react';+import { ListOrdered } from 'lucide-react';+import { Button } from '@librechat/client';import type { ControllerRenderProps } from 'react-hook-form';import type { AgentForm } from '~/common';-import {- AgentGlyph,- AgentRow,- agentIcon,- AddAgentSelect,- AgentSelectInline,- useSelectableAgents,-} from './AgentList';import OrchestrationPattern from './OrchestrationPattern';+import { useSelectableAgents } from './AgentList';import { useLocalize } from '~/hooks';import { CountPill } from './ui';@@ -19,107 +12,34 @@ interface AgentChainProps {currentAgentId: string;}-/** TODO: make configurable */-const MAX_AGENTS = 10;--const Connector = () => (- <Link2 className="mx-auto text-text-tertiary" size={14} aria-hidden="true" />-);--const AgentChain: React.FC<AgentChainProps> = ({ field, currentAgentId }) => {+export default function AgentChain({ field, currentAgentId }: AgentChainProps) {const localize = useLocalize();- const [newAgentId, setNewAgentId] = useState('');- const agentIds = useMemo(() => field.value ?? [], [field.value]);-- const { options, getAgent } = useSelectableAgents({ currentAgentId });-- useEffect(() => {- if (newAgentId && agentIds.length < MAX_AGENTS) {- field.onChange([...agentIds, newAgentId]);- setNewAgentId('');- }- }, [newAgentId, agentIds, field]);-- const removeAgentAt = (index: number) => {- field.onChange(agentIds.filter((_, i) => i !== index));- };-- const updateAgentAt = (index: number, id: string) => {- const updated = [...agentIds];- updated[index] = id;- field.onChange(updated);- };+ const agentIds = field.value ?? [];+ const { getAgent } = useSelectableAgents({ currentAgentId });- const currentAgent = currentAgentId ? getAgent(currentAgentId) : undefined;- const currentName = currentAgent?.name?.trim();+ if (agentIds.length === 0) {+ return null;+ }return (<OrchestrationPatternicon={<ListOrdered className="h-4 w-4" strokeWidth={1.75} aria-hidden="true" />}title={localize('com_ui_agent_chain')}- subtitle={localize('com_ui_agent_chain_subtitle')}- info={<p className="text-sm text-text-secondary">{localize('com_ui_agent_chain_info')}</p>}- trailing={- <CountPill>- {agentIds.length} / {MAX_AGENTS}- </CountPill>- }+ subtitle={localize('com_ui_agent_chain_deprecated')}+ info={<p className="text-text-secondary text-sm">{localize('com_ui_agent_chain_info')}</p>}+ trailing={<CountPill>{agentIds.length}</CountPill>}>- <div className="flex flex-col gap-1.5">- <div className="flex items-center gap-2 px-1 py-1">- {currentName ? (- <>- <AgentGlyph agent={currentAgent} />- <span className="truncate text-sm font-medium text-text-primary">{currentName}</span>- </>- ) : (- <span className="text-sm font-medium text-text-secondary">- {localize('com_ui_agent_chain_self')}- </span>- )}- </div>-- {agentIds.map((agentId, idx) => (- <React.Fragment key={`${agentId}-${idx}`}>- <Connector />- <AgentRow- onRemove={() => removeAgentAt(idx)}- removeLabel={localize('com_ui_remove_agent_from_chain', {- 0: getAgent(agentId)?.name || localize('com_ui_agent'),- })}- >- <AgentSelectInline- options={options}- selectedValue={agentId}- onChange={(id) => updateAgentAt(idx, id)}- displayValue={getAgent(agentId)?.name ?? ''}- icon={agentIcon(getAgent(agentId))}- ariaLabel={localize('com_ui_agent_var', { 0: localize('com_ui_select') })}- />- </AgentRow>- </React.Fragment>+ <ol className="flex flex-col gap-1" aria-label={localize('com_ui_agent_chain')}>+ {agentIds.map((agentId, index) => (+ <li key={`${agentId}-${index}`} className="text-text-secondary text-sm">+ {index + 1}. {getAgent(agentId)?.name ?? agentId}+ </li>))}-- {agentIds.length < MAX_AGENTS && (- <>- <Connector />- <AddAgentSelect- options={options}- onSelect={setNewAgentId}- placeholder={localize('com_ui_agent_var', { 0: localize('com_ui_add') })}- ariaLabel={localize('com_ui_agent_var', { 0: localize('com_ui_add') })}- />- </>- )}-- {agentIds.length >= MAX_AGENTS && (- <p className="pt-1 text-center text-xs italic text-text-tertiary">- {localize('com_ui_agent_chain_max', { 0: MAX_AGENTS })}- </p>- )}- </div>+ </ol>+ <p className="text-text-secondary text-sm">{localize('com_ui_agent_chain_migrate')}</p>+ <Button type="button" variant="outline" onClick={() => field.onChange([])}>+ {localize('com_ui_agent_chain_remove')}+ </Button></OrchestrationPattern>);-};--export default AgentChain;+}diff --git a/client/src/components/SidePanel/Agents/Advanced/__tests__/AgentChain.spec.tsx b/client/src/components/SidePanel/Agents/Advanced/__tests__/AgentChain.spec.tsxnew file mode 100644index 0000000000..db146926a5--- /dev/null+++ b/client/src/components/SidePanel/Agents/Advanced/__tests__/AgentChain.spec.tsx@@ -0,0 +1,54 @@+import { Controller, useForm } from 'react-hook-form';+import { fireEvent, render, screen } from '@testing-library/react';+import type { UseFormReturn } from 'react-hook-form';+import type { ReactNode } from 'react';+import type { AgentForm } from '~/common';+import AgentChain from '../AgentChain';++let mockGetValues: UseFormReturn<AgentForm>['getValues'];+jest.mock('~/hooks', () => ({ useLocalize: () => (key: string) => key }));+jest.mock('../AgentList', () => ({+ useSelectableAgents: () => ({ getAgent: (id: string) => ({ name: id }) }),+}));+jest.mock('../OrchestrationPattern', () => ({+ __esModule: true,+ default: ({ children, subtitle }: { children: ReactNode; subtitle: string }) => (+ <section>+ {subtitle}+ {children}+ </section>+ ),+}));++function Harness({ ids }: { ids: string[] }) {+ const methods = useForm<AgentForm>({+ defaultValues: { agent_ids: ids, subagents: { enabled: true, agent_ids: ['reviewer'] } },+ });+ mockGetValues = methods.getValues;+ return (+ <Controller+ name="agent_ids"+ control={methods.control}+ render={({ field }) => <AgentChain field={field} currentAgentId="parent" />}+ />+ );+}++test('offers no chain authoring for a new or unchained agent', () => {+ const { container } = render(<Harness ids={[]} />);+ expect(container).toBeEmptyDOMElement();+});++test('preserves legacy order and exposes only explicit removal', () => {+ render(<Harness ids={['first', 'second']} />);+ expect(screen.getByText('com_ui_agent_chain_deprecated')).toBeInTheDocument();+ expect(screen.getAllByRole('listitem').map((item) => item.textContent)).toEqual([+ '1. first',+ '2. second',+ ]);+ expect(screen.queryByRole('combobox')).not.toBeInTheDocument();+ expect(mockGetValues('agent_ids')).toEqual(['first', 'second']);+ fireEvent.click(screen.getByRole('button', { name: 'com_ui_agent_chain_remove' }));+ expect(mockGetValues('agent_ids')).toEqual([]);+ expect(mockGetValues('subagents')).toEqual({ enabled: true, agent_ids: ['reviewer'] });+});diff --git a/client/src/components/SidePanel/Agents/__tests__/AgentPanel.helpers.spec.ts b/client/src/components/SidePanel/Agents/__tests__/AgentPanel.helpers.spec.tsindex c8d74c24ea..c308e196d7 100644--- a/client/src/components/SidePanel/Agents/__tests__/AgentPanel.helpers.spec.ts+++ b/client/src/components/SidePanel/Agents/__tests__/AgentPanel.helpers.spec.ts@@ -61,6 +61,16 @@ const createForm = (): AgentForm => ({});describe('composeAgentUpdatePayload', () => {+ it('preserves a legacy chain on unrelated saves and sends explicit removal', () => {+ const form = createForm();+ form.agent_ids = ['first', 'second'];+ expect(composeAgentUpdatePayload(form, 'agent_123').payload.agent_ids).toEqual([+ 'first',+ 'second',+ ]);+ form.agent_ids = [];+ expect(composeAgentUpdatePayload(form, 'agent_123').payload.agent_ids).toEqual([]);+ });it('omits unchanged unavailable machine choices but submits an explicit removal', () => {const form = createForm();form.agent = {diff --git a/client/src/locales/en/translation.json b/client/src/locales/en/translation.jsonindex e1cfd21d45..eac4b19b2f 100644--- a/client/src/locales/en/translation.json+++ b/client/src/locales/en/translation.json@@ -1069,10 +1069,10 @@"com_ui_agent_category_sales": "Sales","com_ui_agent_category_selector_aria": "Agent's category selector","com_ui_agent_chain": "Chain",+ "com_ui_agent_chain_deprecated": "Agent chains are deprecated. Existing chains still run.",+ "com_ui_agent_chain_migrate": "Use subagents or handoffs for new orchestration. Remove this chain before migrating.",+ "com_ui_agent_chain_remove": "Remove chain","com_ui_agent_chain_info": "Enables creating sequences of agents. Each agent can access outputs from previous agents in the chain. Based on the \"Mixture-of-Agents\" architecture where agents use previous outputs as auxiliary information.",- "com_ui_agent_chain_max": "You have reached the maximum of {{0}} agents.",- "com_ui_agent_chain_self": "This agent",- "com_ui_agent_chain_subtitle": "Run a fixed sequence of agents, one after another.","com_ui_agent_delete_error": "There was an error deleting the agent","com_ui_agent_deleted": "Successfully deleted agent","com_ui_agent_description": "Agent description",@@ -2346,7 +2346,6 @@"com_ui_remote_agents_allow_share": "Allow users to grant API access to agents to others","com_ui_remote_agents_allow_share_public": "Allow users to grant API access to agents to all users","com_ui_remote_agents_allow_use": "Allow users to create API keys and query agents remotely",- "com_ui_remove_agent_from_chain": "Remove {{0}} from chain","com_ui_remove_from_project": "Remove from project","com_ui_remove_queued": "Remove message","com_ui_dismiss_unconfirmed_delivery": "Dismiss unconfirmed delivery",diff --git a/e2e/specs/mock/conversation-management.spec.ts b/e2e/specs/mock/conversation-management.spec.tsindex 0c03644584..d410ff067e 100644--- a/e2e/specs/mock/conversation-management.spec.ts+++ b/e2e/specs/mock/conversation-management.spec.ts@@ -373,6 +373,11 @@ test.describe('conversation management', () => {}),);await expect(row).toContainText(renamedTitle);+ if (titleTiming === 'final') {+ await expect(page.getByRole('button', { name: 'Stop generating' })).toBeHidden({+ timeout: 30000,+ });+ }await expect.poll(async () => !!(await titleRequest())).toBe(true);const published = page.waitForResponse((response) =>diff --git a/librechat.example.yaml b/librechat.example.yamlindex f1040ff19c..77759dd394 100644--- a/librechat.example.yaml+++ b/librechat.example.yaml@@ -792,7 +792,7 @@ endpoints:# # (optional) Agent Capabilities available to all users. Omit the ones you wish to exclude. Defaults to list below.# # web_search controls only LibreChat's external pipeline, not provider-native search.# # Both require WEB_SEARCH.USE, seeded by interface.webSearch. See UPGRADING.md.- # capabilities: ["deferred_tools", "execute_code", "file_search", "web_search", "artifacts", "subagents", "actions", "context", "skills", "memory", "ask_user_question", "tools", "chain", "ocr"]+ # capabilities: ["deferred_tools", "execute_code", "file_search", "web_search", "artifacts", "subagents", "actions", "context", "skills", "memory", "ask_user_question", "tools", "ocr"]# # The following capabilities are opt-in and must be added explicitly:# # "programmatic_tools", "stateful_code_sessions", "run_in_background", "tool_intents"# # "stateful_code_sessions" is highly experimental and may change substantially.diff --git a/packages/data-provider/src/chain.spec.ts b/packages/data-provider/src/chain.spec.tsnew file mode 100644index 0000000000..43660bf182--- /dev/null+++ b/packages/data-provider/src/chain.spec.ts@@ -0,0 +1,8 @@+import { AgentCapabilities, defaultAgentCapabilities, agentsEndpointSchema } from './config';++test('retires chain from defaults without rejecting legacy deployment configuration', () => {+ expect(defaultAgentCapabilities).not.toContain(AgentCapabilities.chain);+ expect(+ agentsEndpointSchema.parse({ capabilities: [AgentCapabilities.chain] }).capabilities,+ ).toEqual([AgentCapabilities.chain]);+});diff --git a/packages/data-provider/src/config.ts b/packages/data-provider/src/config.tsindex 5fdaccf951..b14aab8f8a 100644--- a/packages/data-provider/src/config.ts+++ b/packages/data-provider/src/config.ts@@ -709,6 +709,7 @@ export enum AgentCapabilities {memory = 'memory',ask_user_question = 'ask_user_question',tools = 'tools',+ /** @deprecated Retained for legacy configuration. Chain authoring is retired. */chain = 'chain',ocr = 'ocr',run_in_background = 'run_in_background',@@ -887,7 +888,6 @@ export const defaultAgentCapabilities = [AgentCapabilities.memory,AgentCapabilities.ask_user_question,AgentCapabilities.tools,- AgentCapabilities.chain,AgentCapabilities.ocr,];