Skip to content
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

feat(rnd) Agent Marketplace MVP #7657

Merged
merged 55 commits into from
Aug 5, 2024

Conversation

Swiftyos
Copy link
Contributor

@Swiftyos Swiftyos commented Jul 31, 2024

User description

Background

We want to have a marketplace for users to upload and download various agents. This is the backbone.

Changes 🏗️

Adds the marketplace backend and frontend with significant changes

PR Quality Scorecard ✨

  • Have you used the PR description template?   +2 pts
  • Is your pull request atomic, focusing on a single change?   +5 pts
  • Have you linked the GitHub issue(s) that this PR addresses?   +5 pts
  • Have you documented your changes clearly and comprehensively?   +5 pts
  • Have you changed or added a feature?   -4 pts
    • Have you added/updated corresponding documentation?   +4 pts
    • Have you added/updated corresponding integration tests?   +5 pts
  • Have you changed the behavior of AutoGPT?   -5 pts
    • Have you also run agbenchmark to verify that these changes do not regress performance?   +10 pts

PR Type

Enhancement, Tests, Documentation


Description

  • Added backend and frontend for the marketplace.
  • Implemented agent listing, retrieval, and search functionalities.
  • Added analytics tracking for agent views and downloads.
  • Created admin routes for agent management.
  • Added tests for agent listing and retrieval.
  • Updated README with getting started instructions and commands.
  • Added Prisma migrations for Agents, AnalyticsTracker, and FeaturedAgent tables.

Changes walkthrough 📝

Relevant files
Enhancement
23 files
server.py
Add UUID `id` field to `graph` in `create_graph` function.

rnd/autogpt_server/autogpt_server/server/server.py

  • Added id field to graph with a UUID.
+1/-0     
app.py
Refactor app setup and add health check endpoint.               

rnd/market/market/app.py

  • Refactored imports and middleware setup.
  • Added health check endpoint.
  • Included routers for agents, search, and admin.
  • +48/-31 
    db.py
    Implement database interaction functions for agents.         

    rnd/market/market/db.py

  • Added database interaction functions for agents.
  • Implemented agent creation, retrieval, and search functionalities.
  • +440/-0 
    model.py
    Add Pydantic models for agent-related data.                           

    rnd/market/market/model.py

    • Added Pydantic models for agent-related data.
    +88/-0   
    admin.py
    Add admin routes for agent management.                                     

    rnd/market/market/routes/admin.py

    • Added admin routes for creating and featuring agents.
    +63/-0   
    agents.py
    Add routes for listing, retrieving, and downloading agents.

    rnd/market/market/routes/agents.py

  • Added routes for listing, retrieving, and downloading agents.
  • Implemented pagination and filtering for agent listing.
  • +338/-2 
    search.py
    Add search endpoint for agents.                                                   

    rnd/market/market/routes/search.py

    • Added search endpoint for agents.
    +48/-0   
    analytics.py
    Add analytics tracking for agent views and downloads.       

    rnd/market/market/utils/analytics.py

    • Added functions to track agent views and downloads.
    +47/-0   
    extension_types.py
    Add custom Prisma model for agents with rank.                       

    rnd/market/market/utils/extension_types.py

    • Added custom Prisma model for agents with rank.
    +5/-0     
    partial_types.py
    Add partial types for Prisma models.                                         

    rnd/market/market/utils/partial_types.py

    • Added partial types for Prisma models.
    +6/-0     
    scripts.py
    Add utility scripts for project management.                           

    rnd/market/scripts.py

  • Added scripts for linting, formatting, populating database, and
    running the app.
  • +66/-0   
    page.tsx
    Add agent detail page.                                                                     

    rnd/autogpt_builder/src/app/marketplace/[id]/page.tsx

    • Added page for displaying agent details.
    +39/-0   
    page.tsx
    Add marketplace page with search and pagination.                 

    rnd/autogpt_builder/src/app/marketplace/page.tsx

    • Added marketplace page with search and pagination.
    +291/-0 
    AgentDetailContent.tsx
    Add component for displaying agent details.                           

    rnd/autogpt_builder/src/components/AgentDetailContent.tsx

    • Added component for displaying agent details.
    +201/-0 
    NavBar.tsx
    Add marketplace link to navigation bar.                                   

    rnd/autogpt_builder/src/components/NavBar.tsx

    • Added link to marketplace in the navigation bar.
    +13/-1   
    client.ts
    Add marketplace API client.                                                           

    rnd/autogpt_builder/src/lib/marketplace-api/client.ts

    • Added client for interacting with the marketplace API.
    +167/-0 
    index.ts
    Export marketplace API client and types.                                 

    rnd/autogpt_builder/src/lib/marketplace-api/index.ts

    • Exported marketplace API client and types.
    +4/-0     
    types.ts
    Add types for marketplace API.                                                     

    rnd/autogpt_builder/src/lib/marketplace-api/types.ts

    • Added types for marketplace API.
    +58/-0   
    migration.sql
    Add base migration for `Agents` and `AnalyticsTracker` tables.

    rnd/market/migrations/20240731181721_base_migration/migration.sql

  • Added base migration for creating Agents and AnalyticsTracker tables.
  • +61/-0   
    migration.sql
    Add unique constraint on `agentId` in `AnalyticsTracker`.

    rnd/market/migrations/20240731213728_unique_agent_id/migration.sql

    • Added unique constraint on agentId in AnalyticsTracker.
    +11/-0   
    migration.sql
    Add `FeaturedAgent` table.                                                             

    rnd/market/migrations/20240802100955_add_featured_agents/migration.sql

    • Added FeaturedAgent table.
    +20/-0   
    migration.sql
    Set default value of `is_featured` to false in `FeaturedAgent`.

    rnd/market/migrations/20240802174953_default_is_featured_to_false/migration.sql

    • Set default value of is_featured to false in FeaturedAgent.
    +2/-0     
    schema.prisma
    Update Prisma schema for Agents, AnalyticsTracker, and FeaturedAgent.

    rnd/market/schema.prisma

  • Updated Prisma schema for Agents, AnalyticsTracker, and FeaturedAgent.

  • +33/-58 
    Miscellaneous
    1 files
    linter.py
    Remove linter script.                                                                       

    rnd/market/linter.py

    • Removed linter script.
    +0/-27   
    Tests
    1 files
    test_agents.py
    Add tests for agent listing and retrieval.                             

    rnd/market/tests/test_agents.py

    • Added tests for agent listing and retrieval.
    +79/-0   
    Configuration changes
    5 files
    all-projects.code-workspace
    Add `market` project to workspace.                                             

    .vscode/all-projects.code-workspace

    • Added market project to workspace.
    +5/-1     
    .env.example
    Add environment variables for marketplace API.                     

    rnd/autogpt_builder/.env.example

    • Added environment variables for marketplace API.
    +2/-0     
    launch.json
    Add launch configuration for FastAPI.                                       

    rnd/market/.vscode/launch.json

    • Added launch configuration for FastAPI.
    +16/-0   
    migration_lock.toml
    Add migration lock file.                                                                 

    rnd/market/migrations/migration_lock.toml

    • Added migration lock file.
    +3/-0     
    pyproject.toml
    Update dependencies and scripts.                                                 

    rnd/market/pyproject.toml

    • Updated dependencies and scripts.
    +17/-6   
    Documentation
    1 files
    README.md
    Update README with getting started instructions and commands.

    rnd/market/README.md

    • Updated README with getting started instructions and commands.
    +25/-2   

    💡 PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    Copy link

    netlify bot commented Jul 31, 2024

    Deploy Preview for auto-gpt-docs canceled.

    Name Link
    🔨 Latest commit d1187b5
    🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/66aa4f74a6c0100008cd4452

    Copy link

    netlify bot commented Jul 31, 2024

    Deploy Preview for auto-gpt-docs canceled.

    Name Link
    🔨 Latest commit 54ae131
    🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/66b0df6a057b810008edf3a9

    Copy link

    qodo-merge-pro bot commented Aug 1, 2024

    CI Failure Feedback 🧐

    (Checks updated until commit 25376f7)

    Action: test (3.10, windows, sqlite)

    Failed stage: Run Linter [❌]

    Failure summary:

    The action failed because the linter detected an undefined variable error in the file server.py:

  • Line 463: The variable uuid is not defined (reportUndefinedVariable).
    This caused the pyright
    command to return a non-zero exit status, leading to the failure of the linting process.

  • Relevant error logs:
    1:  ##[group]Operating System
    2:  Microsoft Windows Server 2022
    ...
    
    120:  * [new branch]        security/analysis-workflows-sandbox -> origin/security/analysis-workflows-sandbox
    121:  * [new branch]        self-feedback-rough-example -> origin/self-feedback-rough-example
    122:  * [new branch]        server/cli              -> origin/server/cli
    123:  * [new branch]        summary_memory          -> origin/summary_memory
    124:  * [new branch]        swiftyos/blocks         -> origin/swiftyos/blocks
    125:  * [new branch]        swiftyos/example-agents -> origin/swiftyos/example-agents
    126:  * [new branch]        swiftyos/livekit        -> origin/swiftyos/livekit
    127:  * [new branch]        swiftyos/open-1601-paginated-listing-of-store-agents -> origin/swiftyos/open-1601-paginated-listing-of-store-agents
    128:  * [new branch]        swiftyos/secrt-830-error-when-creating-an-agent-from-a-template-installed-from -> origin/swiftyos/secrt-830-error-when-creating-an-agent-from-a-template-installed-from
    ...
    
    679:  |
    680:  461 |                 )
    681:  462 |             graph.version = 1
    682:  463 |             graph.id = str(uuid.uuid4())
    683:  |                            ^^^^ F821
    684:  464 |         else:
    685:  465 |             raise HTTPException(
    686:  |
    687:  Found 1 error.
    688:  All done! \u2728 \U0001f370 \u2728
    689:  58 files would be left unchanged.
    690:  added 1 package, and audited 2 packages in 2m
    691:  found 0 vulnerabilities
    692:  d:\a\AutoGPT\AutoGPT\rnd\autogpt_server\autogpt_server\server\server.py
    693:  d:\a\AutoGPT\AutoGPT\rnd\autogpt_server\autogpt_server\server\server.py:463:28 - error: "uuid" is not defined (reportUndefinedVariable)
    694:  1 error, 0 warnings, 0 informations 
    ...
    
    698:  File "<string>", line 1, in <module>
    699:  File "D:\a\AutoGPT\AutoGPT\rnd\autogpt_server\linter.py", line 21, in lint
    700:  raise e
    701:  File "D:\a\AutoGPT\AutoGPT\rnd\autogpt_server\linter.py", line 18, in lint
    702:  run("pyright")
    703:  File "D:\a\AutoGPT\AutoGPT\rnd\autogpt_server\linter.py", line 10, in run
    704:  subprocess.run(["poetry", "run"] + list(command), cwd=directory, check=True)
    705:  File "C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\subprocess.py", line 526, in run
    706:  raise CalledProcessError(retcode, process.args,
    707:  subprocess.CalledProcessError: Command '['poetry', 'run', 'pyright']' returned non-zero exit status 1.
    708:  >>>>> Running poetry run ruff check . --exit-zero
    709:  >>>>> Running poetry run isort --diff --check --profile black .
    710:  >>>>> Running poetry run black --diff --check .
    711:  >>>>> Running poetry run pyright
    712:  Lint failed, try running `poetry run format` to fix the issues:  Command '['poetry', 'run', 'pyright']' returned non-zero exit status 1.
    713:  ##[error]Process completed with exit code 1.
    

    ✨ CI feedback usage guide:

    The CI feedback tool (/checks) automatically triggers when a PR has a failed check.
    The tool analyzes the failed checks and provides several feedbacks:

    • Failed stage
    • Failed test name
    • Failure summary
    • Relevant error logs

    In addition to being automatically triggered, the tool can also be invoked manually by commenting on a PR:

    /checks "https://github.com/{repo_name}/actions/runs/{run_number}/job/{job_number}"
    

    where {repo_name} is the name of the repository, {run_number} is the run number of the failed check, and {job_number} is the job number of the failed check.

    Configuration options

    • enable_auto_checks_feedback - if set to true, the tool will automatically provide feedback when a check is failed. Default is true.
    • excluded_checks_list - a list of checks to exclude from the feedback, for example: ["check1", "check2"]. Default is an empty list.
    • enable_help_text - if set to true, the tool will provide a help message with the feedback. Default is true.
    • persistent_comment - if set to true, the tool will overwrite a previous checks comment with the new feedback. Default is true.
    • final_update_message - if persistent_comment is true and updating a previous checks message, the tool will also create a new message: "Persistent checks updated to latest commit". Default is true.

    See more information about the checks tool in the docs.

    Copy link

    codecov bot commented Aug 1, 2024

    Codecov Report

    All modified and coverable lines are covered by tests ✅

    Project coverage is 53.82%. Comparing base (0767b17) to head (1c53212).
    Report is 49 commits behind head on master.

    Additional details and impacted files
    @@            Coverage Diff             @@
    ##           master    #7657      +/-   ##
    ==========================================
    + Coverage   49.63%   53.82%   +4.19%     
    ==========================================
      Files         146      124      -22     
      Lines        8926     7032    -1894     
      Branches     1242      912     -330     
    ==========================================
    - Hits         4430     3785     -645     
    + Misses       4348     3113    -1235     
    + Partials      148      134      -14     
    Flag Coverage Δ
    Linux 53.58% <ø> (+4.14%) ⬆️
    Windows 50.43% <ø> (+0.70%) ⬆️
    agbenchmark ?
    autogpt-agent 34.09% <ø> (ø)
    forge 58.03% <ø> (ø)
    macOS 52.90% <ø> (+3.99%) ⬆️

    Flags with carried forward coverage won't be shown. Click here to find out more.

    ☔ View full report in Codecov by Sentry.
    📢 Have feedback on the report? Share it here.

    @Swiftyos Swiftyos changed the title Added listing, sorting, filtering and ordering of agents Agent Marketplace MVP Aug 1, 2024
    @github-actions github-actions bot added the platform/frontend AutoGPT Platform - Front end label Aug 1, 2024
    rnd/market/scripts.py Outdated Show resolved Hide resolved
    @Swiftyos Swiftyos requested review from ntindle and Bentlybro August 5, 2024 13:23
    @Swiftyos Swiftyos merged commit 951abf6 into master Aug 5, 2024
    20 checks passed
    @Swiftyos Swiftyos deleted the swiftyos/open-1601-paginated-listing-of-store-agents branch August 5, 2024 14:51
    @Swiftyos Swiftyos mentioned this pull request Aug 5, 2024
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    enhancement New feature or request platform/backend AutoGPT Platform - Back end platform/frontend AutoGPT Platform - Front end Review effort [1-5]: 5 size/xl tests
    Projects
    Status: Done
    Development

    Successfully merging this pull request may close these issues.

    4 participants