Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
perf(agent-v2): flatten build draft request waterfalls (#41816)
yyh751023c107aa
diff --git a/web/app/components/workflow/nodes/agent-v2/components/__tests__/agent-orchestrate-panel-content.spec.tsx b/web/app/components/workflow/nodes/agent-v2/components/__tests__/agent-orchestrate-panel-content.spec.tsxindex 33384fc5319..3dbc255198d 100644--- a/web/app/components/workflow/nodes/agent-v2/components/__tests__/agent-orchestrate-panel-content.spec.tsx+++ b/web/app/components/workflow/nodes/agent-v2/components/__tests__/agent-orchestrate-panel-content.spec.tsx@@ -568,6 +568,40 @@ describe('WorkflowInlineAgentConfigureWorkspace', () => {)}+ it('should load the build draft while the inline composer is pending', async () => {+ render(+ <WorkflowInlineAgentConfigureWorkspace+ agentId="agent-1"+ flowId="app-1"+ flowType={FlowType.appFlow}+ nodeId="node-1"+ open+ />,+ )++ expect(screen.getByRole('status', { name: 'appApi.loading' })).toBeInTheDocument()+ expect(screen.queryByRole('region', { name: 'orchestrate-panel' })).not.toBeInTheDocument()+ await waitFor(() => expect(mocks.loadBuildDraft).toHaveBeenCalledTimes(1))+ })++ it('should not load the build draft while the inline agent panel is closed', async () => {+ render(+ <WorkflowInlineAgentConfigureWorkspace+ agentId="agent-1"+ flowId="app-1"+ flowType={FlowType.appFlow}+ inlineComposerState={createInlineComposerState()}+ nodeId="node-1"+ open={false}+ />,+ )++ await act(async () => {+ await Promise.resolve()+ })+ expect(mocks.loadBuildDraft).not.toHaveBeenCalled()+ })+async function restartCurrentChat() {fireEvent.click(screen.getByRole('button', {diff --git a/web/app/components/workflow/nodes/agent-v2/components/agent-orchestrate-panel-content.tsx b/web/app/components/workflow/nodes/agent-v2/components/agent-orchestrate-panel-content.tsxindex a50814364d7..7f4d4b006b4 100644--- a/web/app/components/workflow/nodes/agent-v2/components/agent-orchestrate-panel-content.tsx+++ b/web/app/components/workflow/nodes/agent-v2/components/agent-orchestrate-panel-content.tsx@@ -193,7 +193,7 @@ export function WorkflowInlineAgentConfigureWorkspace(| undefined): undefined- if (!agentId || !agentSoulConfig) {+ if (!agentId) {return (<div className="flex h-full min-h-80 items-center justify-center bg-components-panel-bg"><Loading type="app" />@@ -227,7 +227,7 @@ function WorkflowInlineAgentConfigureWorkspaceComposerScope({}: Omit<WorkflowInlineAgentConfigureWorkspaceProps, 'agentId'> & {activeConfigSnapshot?: AgentConfigSnapshotSummaryResponse | nullagentId: string- agentSoulConfig: AgentSoulConfig+ agentSoulConfig?: AgentSoulConfig}) {const soulSourceOverride = useAtomValue(agentConfigureSoulSourceOverrideAtom)const rightPanelMode = useAtomValue(agentConfigureRightPanelModeAtom)@@ -236,7 +236,7 @@ function WorkflowInlineAgentConfigureWorkspaceComposerScope({agentId,activeVersionId: activeConfigSnapshot?.id,composerAgentSoulConfig: agentSoulConfig,- isBuildMode: rightPanelMode === 'build',+ isBuildMode: props.open && rightPanelMode === 'build',isViewingVersion: false,normalAgentSoulConfig: agentSoulConfig,setSoulSourceOverride,@@ -244,7 +244,7 @@ function WorkflowInlineAgentConfigureWorkspaceComposerScope({})const composerSessionKey = `${props.nodeId}:${agentId}`- if (buildDraft.isPending) {+ if (!agentSoulConfig || buildDraft.isPending) {return (<div className="flex h-full min-h-80 items-center justify-center bg-components-panel-bg"><Loading type="app" />diff --git a/web/features/agent-v2/agent-detail/configure/__tests__/page.spec.tsx b/web/features/agent-v2/agent-detail/configure/__tests__/page.spec.tsxindex 795ba76588d..7b3e49e9ad4 100644--- a/web/features/agent-v2/agent-detail/configure/__tests__/page.spec.tsx+++ b/web/features/agent-v2/agent-detail/configure/__tests__/page.spec.tsx@@ -604,7 +604,7 @@ describe('AgentConfigurePage', () => {})describe('Loading state', () => {- it('should show the page loading indicator instead of skeleton panels while composer data is pending', () => {+ it('should load the build draft while keeping the page pending with composer data', () => {const queryClient = new QueryClient()render(@@ -620,6 +620,13 @@ describe('AgentConfigurePage', () => {expect(configureSection).toHaveClass('bg-background-body')expect(screen.getByRole('status', { name: 'appApi.loading' })).toBeInTheDocument()expect(screen.queryByRole('region', { name: 'orchestrate-panel' })).not.toBeInTheDocument()+ expect(+ vi+ .mocked(useQuery)+ .mock.calls.find(+ ([options]) => Array.isArray(options.queryKey) && options.queryKey[0] === 'build-draft',+ )?.[0],+ ).toMatchObject({ enabled: true })})it('should initialize the composer from the active build draft after its pending check', () => {@@ -781,6 +788,13 @@ describe('AgentConfigurePage', () => {expect(screen.getByRole('region', { name: 'preview-chat' })).toHaveTextContent('preview:none')expect(screen.queryByRole('region', { name: 'build-chat' })).not.toBeInTheDocument()+ expect(+ vi+ .mocked(useQuery)+ .mock.calls.find(+ ([options]) => Array.isArray(options.queryKey) && options.queryKey[0] === 'build-draft',+ )?.[0],+ ).toMatchObject({ enabled: false })})it('should switch modes without confirmation before Build chat starts', async () => {diff --git a/web/features/agent-v2/agent-detail/configure/components/composer-session.tsx b/web/features/agent-v2/agent-detail/configure/components/composer-session.tsxindex f5081ae70b6..d821ae639d8 100644--- a/web/features/agent-v2/agent-detail/configure/components/composer-session.tsx+++ b/web/features/agent-v2/agent-detail/configure/components/composer-session.tsx@@ -89,20 +89,14 @@ export function AgentConfigureComposerScope({setSoulSourceOverride,soulSourceOverride,})- const sessionController = useAgentConfigureSessionController({- buildDraftAgentSoulConfig: buildDraft.buildDraftAgentSoulConfig,- hasActiveBuildDraft: buildDraft.hasActiveBuildDraft,- isBuildDraftActive: buildDraft.isActive,- mode: rightPanelMode,- normalAgentSoulConfig: agentSoulConfig,- onModeChange: onRightPanelModeChange,- })-useEffect(() => {if (!buildDraft.isPending) initializedComposerAgentIdRef.current = agentId}, [agentId, buildDraft.isPending])- if (buildDraft.isPending && initializedComposerAgentIdRef.current !== agentId) {+ if (+ configureData.isPending ||+ (buildDraft.isPending && initializedComposerAgentIdRef.current !== agentId)+ ) {return <AgentConfigurePageLoading label={t(($) => $['agentDetail.sections.configure'])} />}@@ -118,8 +112,8 @@ export function AgentConfigureComposerScope({isViewingVersion={isViewingVersion}previewEnabled={previewEnabled}rightPanelMode={rightPanelMode}- sessionController={sessionController}onComposerRebase={onComposerRebase}+ onRightPanelModeChange={onRightPanelModeChange}onSelectVersion={onSelectVersion}/>)@@ -133,8 +127,8 @@ function AgentConfigurePageComposerSession({isViewingVersion,previewEnabled,rightPanelMode,- sessionController,onComposerRebase,+ onRightPanelModeChange,onSelectVersion,}: {agentId: string@@ -144,12 +138,20 @@ function AgentConfigurePageComposerSession({isViewingVersion: booleanpreviewEnabled: booleanrightPanelMode: AgentConfigureRightPanelMode- sessionController: ReturnType<typeof useAgentConfigureSessionController>onComposerRebase: () => void+ onRightPanelModeChange: (mode: AgentConfigureRightPanelMode) => void | Promise<unknown>onSelectVersion: (versionId: string | null) => void}) {- const { agentQuery } = configureData+ const { agentQuery, agentSoulConfig } = configureDataconst queryClient = useQueryClient()+ const sessionController = useAgentConfigureSessionController({+ buildDraftAgentSoulConfig: buildDraft.buildDraftAgentSoulConfig,+ hasActiveBuildDraft: buildDraft.hasActiveBuildDraft,+ isBuildDraftActive: buildDraft.isActive,+ mode: rightPanelMode,+ normalAgentSoulConfig: agentSoulConfig,+ onModeChange: onRightPanelModeChange,+ })const agentIconType = agentQuery.data?.icon_type as AgentIconType | null | undefinedconst refreshDebugConversationMutation = useMutation(consoleQuery.agent.byAgentId.debugConversation.refresh.post.mutationOptions({diff --git a/web/features/agent-v2/agent-detail/configure/page.tsx b/web/features/agent-v2/agent-detail/configure/page.tsxindex 815558fb768..dfad7370c55 100644--- a/web/features/agent-v2/agent-detail/configure/page.tsx+++ b/web/features/agent-v2/agent-detail/configure/page.tsx@@ -6,10 +6,8 @@ import { useAtomValue, useSetAtom } from 'jotai'import { ScopeProvider } from 'jotai-scope'import { parseAsStringLiteral, useQueryState } from 'nuqs'import { useCallback } from 'react'-import { useTranslation } from 'react-i18next'import { systemFeaturesQueryOptions } from '@/features/system-features/client'import { AgentConfigureComposerScope } from './components/composer-session'-import { AgentConfigurePageLoading } from './components/page-loading'import { useAgentConfigureData } from './hooks'import {AGENT_CONFIGURE_RIGHT_PANEL_MODES,@@ -37,7 +35,6 @@ export function AgentConfigurePage({ agentId }: AgentConfigurePageProps) {}function AgentConfigurePageContent({ agentId }: AgentConfigurePageProps) {- const { t } = useTranslation('agentV2')const [requestedMode, setRequestedMode] = useQueryState('mode', agentConfigureModeQueryParser)const selectedVersionId = useAtomValue(agentConfigureSelectedVersionIdAtom)const composerRebaseRevision = useAtomValue(agentConfigureComposerRebaseRevisionAtom)@@ -59,10 +56,6 @@ function AgentConfigurePageContent({ agentId }: AgentConfigurePageProps) {[previewEnabled, setRequestedMode],)- if (configureData.isPending) {- return <AgentConfigurePageLoading label={t(($) => $['agentDetail.sections.configure'])} />- }-return (<AgentConfigureComposerScopeagentId={agentId}