Skip to content

Commit

Permalink
feature(platform): Implement library add, update, remove, archive fun…
Browse files Browse the repository at this point in the history
…ctionality (#9218)

### Changes 🏗️

1. **Core Features**:
   - Add agents to the user's library.
   - Update library agents (auto-update, favorite, archive, delete).
   - Paginate library agents and presets.
   - Execute graphs using presets.

2. **Refactoring**:
   - Replaced `UserAgent` with `LibraryAgent`.
   - Separated routes for agents and presets.

3. **Schema Changes**:
- Added `LibraryAgent` table with fields like `isArchived`, `isDeleted`,
etc.
   - Soft delete functionality for `AgentPreset`.

4. **Testing**:
   - Updated tests for `LibraryAgent` operations.
   - Added edge case tests for deletion, archiving, and pagination.

5. **Database Migrations**:
   - Migration to drop `UserAgent` and add `LibraryAgent`.
   - Added fields for soft deletion and auto-update.


Note this includes the changes from the following PR's to avoid merge
conflicts with them:

#9179 
#9211

---------

Co-authored-by: Reinier van der Leer <[email protected]>
  • Loading branch information
Swiftyos and Pwuts authored Jan 10, 2025
1 parent 4b17cc9 commit fd6f28f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 0 additions & 2 deletions autogpt_platform/backend/backend/server/v2/library/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,6 @@ async def create_or_update_preset(
preset_id: str | None = None,
) -> backend.server.v2.library.model.LibraryAgentPreset:
try:

logger.info(f"DB Creating Preset with inputs: {preset.inputs}")
new_preset = await prisma.models.AgentPreset.prisma().upsert(
where={
"id": preset_id if preset_id else "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class LibraryAgentPreset(pydantic.BaseModel):
description: str

is_active: bool

inputs: dict[str, typing.Union[backend.data.block.BlockInput, typing.Any]]

@staticmethod
Expand Down

0 comments on commit fd6f28f

Please sign in to comment.