[Agent Builder] Migrate existing routes to new UX#258241
Conversation
| {isEmbeddedContext && ( | ||
| <EuiFlexItem grow={false}> | ||
| <EuiTourStep {...getStepProps(TourStep.AgentSelector)}> | ||
| <AgentSelector agentId={agentId} /> | ||
| </EuiTourStep> | ||
| </EuiFlexItem> | ||
| )} |
There was a problem hiding this comment.
Just hides the old AgentSelector from the conversation input when in full-screen mode. In a future ticket we will remove this entirely when it moves to the header of the sidebar.
|
|
||
| import React, { useCallback } from 'react'; | ||
| import { Link } from 'react-router-dom-v5-compat'; | ||
| import { useLocation } from 'react-router-dom'; |
There was a problem hiding this comment.
This file just has updates because I had to add the conversations to the sidebar to make sure navigation worked. Actually fixing the UI for the sidebar will be done in a separate PR so I wouldn't pay too much attention to this one.
| currentConversationId, | ||
| }) => { | ||
| const { euiTheme } = useEuiTheme(); | ||
| const { conversations = [], isLoading } = useConversationList({ agentId }); |
There was a problem hiding this comment.
Only gets and lists the conversations for the agent in context.
| legacy: { | ||
| conversation: ({ conversationId }: { conversationId: string }) => | ||
| `/conversations/${conversationId}`, | ||
| }, | ||
|
|
||
| // Backward compatibility aliases pointing to new routes | ||
| // TODO: Migrate consumers to use appPaths.agent.* or appPaths.manage.* directly and remove these aliases | ||
| chat: { | ||
| new: '/agents/elastic-default', | ||
| newWithAgent: ({ agentId }: { agentId: string }) => `/agents/${agentId}`, | ||
| }, | ||
| agents: { | ||
| list: '/manage/agents', | ||
| new: '/manage/agents/new', | ||
| edit: ({ agentId }: { agentId: string }) => `/manage/agents/${agentId}`, | ||
| }, | ||
| tools: { | ||
| list: '/manage/tools', | ||
| new: '/manage/tools/new', | ||
| details: ({ toolId }: { toolId: string }) => `/manage/tools/${toolId}`, | ||
| bulkImportMcp: '/manage/tools/bulk_import_mcp', | ||
| }, | ||
| skills: { | ||
| list: '/manage/skills', | ||
| new: '/manage/skills/new', | ||
| details: ({ skillId }: { skillId: string }) => `/manage/skills/${skillId}`, | ||
| }, | ||
| plugins: { | ||
| list: '/manage/plugins', | ||
| details: ({ pluginId }: { pluginId: string }) => `/manage/plugins/${pluginId}`, | ||
| }, |
There was a problem hiding this comment.
So right now, we either add these BWC legacy paths or update 43 files throughout our code to use the new paths directly - I chose the easiest for now 😄 lets see if this new UI ever lands before we consider this change.
| export const getConversationIdFromPath = (pathname: string): string | undefined => { | ||
| const match = pathname.match(/^\/agents\/[^/]+\/conversations\/([^/]+)/); | ||
| return match ? match[1] : undefined; | ||
| }; |
There was a problem hiding this comment.
Used only in the sidebar, as it's rendered outside the context of the conversation related hooks we cannot use useConversationId there. Sidebar is rendered at the very top as it's persisted on every route, even non-conversation ones.
💔 Build Failed
Failed CI StepsTest Failures
Metrics [docs]
Historycc @chrisbmar |
| // Backward compatibility aliases pointing to new routes | ||
| // TODO: Migrate consumers to use appPaths.agent.* or appPaths.manage.* directly and remove these aliases | ||
| chat: { | ||
| new: '/agents/elastic-default', |
There was a problem hiding this comment.
question: should this be elastic-ai-agent and not elastic-default?
There was a problem hiding this comment.
these should be removed in favour of just navigating to the root now, I've removed them here.
SiddharthMantri
left a comment
There was a problem hiding this comment.
LGTM overall. Left a couple of questions but nothing major.
| } else { | ||
| navigateToAgentBuilderUrl(appPaths.chat.conversation({ conversationId: conversation.id })); | ||
| // Use legacy path - LegacyConversationRedirect fetches conversation and redirects to correct agent-scoped URL | ||
| navigateToAgentBuilderUrl( |
There was a problem hiding this comment.
Question: could this be replced by:
navigateToAgentBuilderUrl(
appPaths.agent.conversations.byId({
agentId: conversation.agent_id,
conversationId: conversation.id,
})
);
Since we have agent_id in the conversation response already?
There was a problem hiding this comment.
yes that's exactly what we will do when we remove/recreate this component in the header of the sidebar, good spot!
85cf346
into
elastic:ab-agent-centric-ux-feature-branch
closes https://github.com/elastic/search-team/issues/13361
See video below for an example of what's been migrated (note: there are still many routes that do not have a UI yet, this is deliberate and they will be handled in future PRs)
Screen.Recording.2026-03-17.at.21.02.05.mov