AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

feat: allow admins to download agents for review

Open ntindle opened this issue 7 months ago β€’ 4 comments

for admins to approve agents for the marketplace, we need to be able to run them. this is a quick workaround for downloading them so you can put them in your marketplace to check

Changes πŸ—οΈ

  • clones various endpoints related to downloading into an admin side with logging, and admin checks
  • adds download button and removes open in builder action

Checklist πŸ“‹

For code changes:

  • [ ] I have clearly listed my changes in the PR description
  • [ ] I have made a test plan
  • [ ] I have tested my changes according to the test plan:
    • [ ] Test downloading agents from local marketplace

ntindle avatar Apr 25 '25 22:04 ntindle

PR Reviewer Guide πŸ”

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 πŸ”΅πŸ”΅πŸ”΅βšͺβšͺ
πŸ§ͺΒ No relevant tests
πŸ”’Β No security concerns identified
⚑ Recommended focus areas for review

JSON Parsing Issue

The download function is parsing the file data as JSON and then stringifying it again, which may cause issues if the data is already in JSON format. This could lead to double-encoding or malformed JSON files.

const jsonData = JSON.stringify(fileData, null, 2);
const blob = new Blob([jsonData], { type: "application/json" });
Access Control Logic

The access control logic in get_graph_as_admin seems to contradict its purpose. Despite being an admin function, it still checks if the graph is owned by the user or listed in the store, which may prevent admins from accessing certain graphs.

if graph is None or (
    graph.userId != user_id
    and not (
        await StoreListingVersion.prisma().find_first(
            where={
                "agentGraphId": graph_id,
                "agentGraphVersion": version or graph.version,
            }
        )
    )
):
    return None
Error Handling

The download function catches errors but only logs them to the console without providing any user feedback when a download fails.

} catch (error) {
  console.error("Download failed:", error);
} finally {

qodo-code-review[bot] avatar Apr 25 '25 22:04 qodo-code-review[bot]

Deploy Preview for auto-gpt-docs-dev canceled.

Name Link
Latest commit 3ec3af143a168da876b2943fcd2c36230c76c73f
Latest deploy log https://app.netlify.com/sites/auto-gpt-docs-dev/deploys/680fbc2f8be9640008273ddd

netlify[bot] avatar Apr 25 '25 22:04 netlify[bot]

Deploy Preview for auto-gpt-docs canceled.

Name Link
Latest commit 3ec3af143a168da876b2943fcd2c36230c76c73f
Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/680fbc2f91af0000078a0858

netlify[bot] avatar Apr 25 '25 22:04 netlify[bot]

Here's the code health analysis summary for commits 5b5b204..3ec3af1. View details on DeepSourceΒ β†—.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource JavaScript LogoJavaScriptβœ…Β Success
❗ 5 occurences introduced
🎯 2 occurences resolved
View CheckΒ β†—
DeepSource Python LogoPythonβœ…Β Success
❗ 1 occurence introduced
View CheckΒ β†—

πŸ’‘ If you’re a repository administrator, you can configure the quality gates from the settings.

deepsource-io[bot] avatar Apr 25 '25 22:04 deepsource-io[bot]