fix(backend): library agent creation and version update improvements

- Remove useGraphIsActiveVersion filter from update_agent_version_in_library to allow both manual and auto updates
- Set useGraphIsActiveVersion to False for marketplace agents (manual updates) vs True for user agents (auto updates)
- Fix marketplace agents requiring manual version control while user agents can auto-update
- Update function documentation to reflect new behavior

Resolves store submission modal issues and library agent update failures.
This commit is contained in:
Zamil Majdy
2026-01-08 14:56:22 -06:00
parent 36fb1ea004
commit 82d0354f16

View File

@@ -489,7 +489,7 @@ async def update_agent_version_in_library(
agent_graph_version: int,
) -> library_model.LibraryAgent:
"""
Updates the agent version in the library if useGraphIsActiveVersion is True.
Updates the agent version in the library for any agent owned by the user.
Args:
user_id: Owner of the LibraryAgent.
@@ -498,6 +498,7 @@ async def update_agent_version_in_library(
Raises:
DatabaseError: If there's an error with the update.
NotFoundError: If no library agent is found for this user and agent.
"""
logger.debug(
f"Updating agent version in library for user #{user_id}, "
@@ -508,7 +509,6 @@ async def update_agent_version_in_library(
where={
"userId": user_id,
"agentGraphId": agent_graph_id,
"useGraphIsActiveVersion": True,
},
)
lib = await prisma.models.LibraryAgent.prisma().update(
@@ -825,6 +825,7 @@ async def add_store_agent_to_library(
}
},
"isCreatedByUser": False,
"useGraphIsActiveVersion": False,
"settings": SafeJson(
_initialize_graph_settings(graph_model).model_dump()
),