diff --git a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/OldAgentLibraryView.tsx b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/OldAgentLibraryView.tsx
index 54cc07878d..70631a0218 100644
--- a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/OldAgentLibraryView.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/OldAgentLibraryView/OldAgentLibraryView.tsx
@@ -407,7 +407,10 @@ export function OldAgentLibraryView() {
api
.forkLibraryAgent(agentID)
.then((newAgent) => {
- router.push(`/library/agents/${newAgent.id}`);
+ // Navigate directly to the builder with the new agent's graph
+ router.push(
+ `/build?flowID=${newAgent.graph_id}&flowVersion=${newAgent.graph_version}`,
+ );
})
.catch((error) => {
console.error("Error copying agent:", error);
@@ -419,28 +422,31 @@ export function OldAgentLibraryView() {
});
}, [agentID, api, router, toast]);
+ const handleCustomizeAgent = useCallback(() => {
+ if (agent?.can_access_graph) {
+ // User owns this agent, navigate directly to builder
+ router.push(
+ `/build?flowID=${agent.graph_id}&flowVersion=${agent.graph_version}`,
+ );
+ } else {
+ // Marketplace agent - show copy confirmation dialog
+ setCopyAgentDialogOpen(true);
+ }
+ }, [agent, router]);
+
const agentActions: ButtonAction[] = useMemo(
() => [
{
label: "Customize agent",
- href: `/build?flowID=${agent?.graph_id}&flowVersion=${agent?.graph_version}`,
- disabled: !agent?.can_access_graph,
+ callback: handleCustomizeAgent,
},
{ label: "Export agent to file", callback: downloadGraph },
- ...(!agent?.can_access_graph
- ? [
- {
- label: "Edit a copy",
- callback: () => setCopyAgentDialogOpen(true),
- },
- ]
- : []),
{
label: "Delete agent",
callback: () => setAgentDeleteDialogOpen(true),
},
],
- [agent, downloadGraph],
+ [handleCustomizeAgent, downloadGraph],
);
const runGraph =
@@ -600,10 +606,9 @@ export function OldAgentLibraryView() {
You're making an editable copy
The original Marketplace agent stays the same and cannot be
- edited. We'll save a new version of this agent to your
- Library. From there, you can customize it however you'd
- like by clicking "Customize agent" — this will open
- the builder where you can see and modify the inner workings.
+ edited. We'll create a copy of this agent in your Library
+ and open it in the builder where you can see and modify its
+ inner workings.