-
Notifications
You must be signed in to change notification settings - Fork 45.7k
feat(backend): Agent Presets backend improvements #9786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
…dpoints) Frontend: - Add logic to fetch, select/view, and create presets to `/library/agents/[id]` - refactor: Brand `LibraryAgentPreset.id` + references Backend: - Add `graph_id` filter parameter to `GET /library/presets` (`list_presets`) endpoint
✅ Deploy Preview for auto-gpt-docs-dev canceled.
|
Here's the code health analysis summary for commits Analysis Summary
|
✅ Deploy Preview for auto-gpt-docs canceled.
|
Distilled from #9541 to reduce the scope of that PR. - Part of #9307 - ❗ Blocks #9786 - ❗ Blocks #9541 ### Changes 🏗️ - Fix `LibraryAgent` schema (for #9786) - Fix relationships between `LibraryAgent`, `AgentGraph`, and `AgentPreset` - Impose uniqueness constraint on `LibraryAgent` - Rename things that are called `agent` that actually refer to a `graph`/`agentGraph` - Fix singular/plural forms in DB schema - Simplify reference names of closely related objects (e.g. `AgentGraph.AgentGraphExecutions` -> `AgentGraph.Executions`) - Eliminate use of `# type: ignore` in DB statements - Add `typed` and `typed_cast` utilities to `backend.util.type` ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: - [x] CI static type checking (with all risky `# type: ignore` removed) - [x] Check that column references in views are updated
This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request. |
Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly. |
This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request. |
Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly. |
@@ -232,7 +234,7 @@ async def create_library_agent( | |||
isCreatedByUser=(user_id == graph.user_id), | |||
useGraphIsActiveVersion=True, | |||
User={"connect": {"id": user_id}}, | |||
# Creator={"connect": {"id": agent.userId}}, | |||
# Creator={"connect": {"id": graph.user_id}}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this commented out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, it was like that when I found it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we annotate and find out the context?
This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request. |
@@ -113,7 +126,12 @@ async def create_preset( | |||
HTTPException: If an error occurs while creating the preset. | |||
""" | |||
try: | |||
return await db.upsert_preset(user_id, preset) | |||
if isinstance(preset, models.LibraryAgentPresetCreatable): | |||
return await db.create_preset(user_id, preset) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pattern is not neat. We've been catching exceptions through middleware, we can just generally return 404 on any not found exception error that way rather than spamming try catch in all of our endpoint code, similarly with 500.
Let me know when you have resolved the conflicts so I can reapprove |
Part of Implement Agent Presets functionality #9307
❗ Blocks feat(platform): Agent Presets UX #9541
Changes 🏗️
Backend:
Fix+improve
GET /library/presets
(list_presets
) endpointgraph_id
filter parameterAllow partial preset updates:
PUT /presets/{preset_id}
->PATCH /presets/{preset_id}
Allow creating preset from graph execution through
POST /presets
Clean up models & DB functions
upsert_preset
intocreate_preset
+update_preset
LibraryAgentPresetUpdatable
CreateLibraryAgentPresetRequest
withLibraryAgentPresetCreatable
LibraryAgentPresetCreatable
as base class forLibraryAgentPreset
set_is_deleted_for_library_agent(..)
Frontend:
LibraryAgentPreset.id
+ referencesChecklist 📋
For code changes: