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

feature(backend): Add ability to execute store agents without agent ownership #9179

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from

Conversation

Swiftyos
Copy link
Contributor

@Swiftyos Swiftyos commented Jan 3, 2025

Description

This PR enables the execution of store agents even if they are not owned by the user. Key changes include handling store-listed agents in the get_graph logic, improving execution flow, and ensuring version-specific handling. These updates support more flexible agent execution.

Changes 🏗️

  • Graph Retrieval: Updated get_graph to check store listings for agents not owned by the user.
  • Version Handling: Added graph_version to execution methods for consistent version-specific execution.
  • Execution Flow: Refactored scheduler.py, rest_api.py, and other modules for clearer logic and better maintainability.
  • Testing: Updated test_manager.py and other test cases to validate execution of store-listed agents.

Checklist 📋

Code Changes:

  • Listed changes in the PR description.
  • Created a test plan:
    • Execute store-listed agents without ownership.
    • Validate private agent execution.
    • Test import/export and marketplace workflows.
    • Run integration tests for graph execution.

Configuration Changes:

  • .env.example and docker-compose.yml are compatible.
  • No configuration changes required.

Test Plan

  • Execute a store-listed agent without ownership.
  • Import an agent via file upload and verify execution.
  • Test marketplace upload and import.
  • Validate edited agent execution from the monitor.

Copy link

supabase bot commented Jan 3, 2025

This pull request has been ignored for the connected project bgwpwdsxblryihinutbx because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

Copy link
Contributor

github-actions bot commented Jan 3, 2025

This PR targets the master branch but does not come from dev or a hotfix/* branch.

Automatically setting the base branch to dev.

@github-actions github-actions bot changed the base branch from master to dev January 3, 2025 10:27
@github-actions github-actions bot added platform/backend AutoGPT Platform - Back end size/m labels Jan 3, 2025
Copy link

netlify bot commented Jan 3, 2025

Deploy Preview for auto-gpt-docs canceled.

Name Link
🔨 Latest commit 37e8b51
🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/677e2ef3e53b030008d7118e

@Swiftyos Swiftyos marked this pull request as ready for review January 3, 2025 12:35
@Swiftyos Swiftyos requested a review from a team as a code owner January 3, 2025 12:35
@Swiftyos Swiftyos requested review from Bentlybro and majdyz and removed request for a team January 3, 2025 12:35
Copy link

qodo-merge-pro bot commented Jan 3, 2025

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Access Control

The new store listing access check logic should be carefully reviewed to ensure it properly restricts access to only published store agents and prevents unauthorized access to private agents.

if graph.userId == user_id:
    return GraphModel.from_db(graph, for_export) if graph else None

# If the graph is not owned by the user, we need to check if it's a store listing.
if not version:
    version = graph.version

store_listing_where: StoreListingWhereInput = {
    "agentId": graph_id,
    "agentVersion": version,
}

store_listing = await StoreListing.prisma().find_first(where=store_listing_where)

# If it is not a store listing, return None
if not store_listing:
    return None

# If it is a store listing, return the graph model
return GraphModel.from_db(graph, for_export) if graph else None
Breaking Change

The graph_version parameter was made required in add_execution() which could break existing code that doesn't pass this parameter. Verify all callers have been updated.

def add_execution(
    self,
    graph_id: str,
    data: BlockInput,
    user_id: str,
    graph_version: int,
) -> GraphExecutionEntry:
    graph: GraphModel | None = self.db_client.get_graph(
        graph_id=graph_id, user_id=user_id, version=graph_version
    )

Copy link

netlify bot commented Jan 3, 2025

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

Name Link
🔨 Latest commit 37e8b51
🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs-dev/deploys/677e2ef3479a6600085329f2

…without-agent-ownership' of github.com:Significant-Gravitas/AutoGPT into swiftyos/open-2276-add-ability-to-execute-store-agents-without-agent-ownership
@Swiftyos Swiftyos requested a review from Pwuts January 7, 2025 15:59
@Pwuts Pwuts changed the title feature(platform): add ability to execute store agents without agent ownership feature(backend): Add ability to execute store agents without agent ownership Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants