Skip to content

feat(platform/library): Triggered-agent support #10167

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

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

Conversation

Pwuts
Copy link
Member

@Pwuts Pwuts commented Jun 16, 2025

This pull request adds support for setting up (webhook-)triggered agents in the Library. It contains changes throughout the entire stack to make everything work in the various phases of a triggered agent's lifecycle: setup, execution, updates, deletion.

Setting up agents with webhook triggers was previously only possible in the Builder, limiting their use to the agent's creator only. To make it work in the Library, this change uses the previously introduced AgentPreset to store information on, instead of on the graph's nodes to which only a graph's creator has access.

screenshot of trigger setup screen in the library
screenshot of trigger edit screen in the library

Changes 🏗️

Frontend:

  • Amend the Library's AgentRunDraftView to handle creating and editing Presets
    • Add hideIfSingleCredentialAvailable parameter to CredentialsInput
    • Add multi-select support to TypeBasedInput
  • Add Presets section to AgentRunsSelectorList
    • Amend AgentRunSummaryCard for use for Presets
      • Add AgentStatusChip to display general agent status (for now: Active / Inactive / Error)
  • Add Preset loading logic and create/update/delete handlers logic to AgentRunsPage
  • Rename IconClose to IconCross

API:

  • Add LibraryAgent properties has_external_trigger, trigger_setup_info, credentials_input_schema
  • Add POST /library/agents/{library_agent_id}/setup_trigger endpoint
  • Remove redundant parameters from POST /library/presets/{preset_id}/execute endpoint

Backend:

  • Add POST /library/agents/{library_agent_id}/setup_trigger endpoint
    • Extract non-node-related logic from on_node_activate into setup_webhook_for_block
  • Add webhook-related logic to update_preset and delete_preset endpoints
  • Amend webhook infrastructure to work with AgentPresets
    • Add preset trigger support to webhook ingress endpoint
      • Amend executor stack to work with passed-in node input (nodes_input_masks, generalized from node_credentials_input_map)
      • Amend graph validation to work with passed-in node input
    • Add AgentPreset->IntegrationWebhook relation
      • Add WebhookWithRelations model
  • Change behavior of BaseWebhooksManager.get_manual_webhook(..) to avoid unnecessary changes of the webhook URL: ignore events to find matching webhook, and update events if necessary.
  • Fix & improve AgentPreset API, models, and DB logic
    • Add isDeleted filter to get/list queries
    • Add user_id attribute to LibraryAgentPreset model
    • Add separate credentials property to LibraryAgentPreset model
    • Fix library_db.update_preset(..) replacement of existing InputPresets
    • Make library_db.update_preset(..) more usage-friendly with separate parameters for updateable properties
  • Add user_id checks to various DB functions
  • Fix error handling in various endpoints
  • Fix cache race condition on load_webhook_managers()

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 existing functionality
      • Auto-setup and -teardown of webhooks on save in the builder still works
      • Running an agent normally from the Library still works
    • Test new functionality
      • Setting up a trigger in the Library
      • Updating a trigger in the Library
      • Disabling and re-enabling a trigger in the Library
      • Deleting a trigger in the Library
      • Triggers set up in the Library result in a new run when the webhook receives a payload

Copy link

netlify bot commented Jun 16, 2025

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

Name Link
🔨 Latest commit 610f93b
🔍 Latest deploy log https://app.netlify.com/projects/auto-gpt-docs-dev/deploys/685aced550d3470008ab211f

@github-actions github-actions bot added platform/backend AutoGPT Platform - Back end size/l labels Jun 16, 2025
Copy link

netlify bot commented Jun 16, 2025

Deploy Preview for auto-gpt-docs canceled.

Name Link
🔨 Latest commit 610f93b
🔍 Latest deploy log https://app.netlify.com/projects/auto-gpt-docs/deploys/685aced550d3470008ab211d

Copy link

deepsource-io bot commented Jun 16, 2025

Here's the code health analysis summary for commits 94aed94..610f93b. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource JavaScript LogoJavaScript✅ Success
❗ 30 occurences introduced
🎯 15 occurences resolved
View Check ↗
DeepSource Python LogoPython✅ Success
❗ 44 occurences introduced
🎯 25 occurences resolved
View Check ↗

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

@AutoGPT-Agent
Copy link

Thank you for your PR implementing webhook-triggered agent support. The code changes look good, but since this is marked as WIP, there are a few things to address before it can be merged:

  1. Please expand the PR description with more details about what this feature does and the specific changes you've made. While the reference to issue Explore technical implementation for webhook-triggered library agents #10111 is helpful, a summary of the implementation would provide better context.

  2. None of the checklist items are checked off. Please complete the checklist, particularly:

    • Clearly listing your changes in the PR description
    • Creating and documenting a test plan
    • Confirming you've tested according to that plan
  3. If there are any configuration changes needed for this feature, please document them.

Your code changes look solid - I especially appreciate how you've maintained the user_id checks in the webhook-related functions and updated the database schema appropriately. Once you've completed the PR description and checklist, this should be ready for further review.

@github-actions github-actions bot added the platform/frontend AutoGPT Platform - Front end label Jun 16, 2025
@AutoGPT-Agent
Copy link

Thank you for your work on adding webhook-triggered agent support to the platform. Since this is marked as a Work in Progress (WIP), I understand it's not yet ready for full review, but here are some points to address before this can be merged:

  1. PR Description: Please provide a comprehensive description of the changes you've made. Currently, it only says "WIP". Even for a work-in-progress PR, it's important to document what you've done so far and what still needs to be completed.

  2. Checklist: None of the items in the checklist are checked off. Please update the checklist to reflect the current status of your work, checking off completed items.

  3. Test Plan: Develop and document a test plan for this feature. Since this involves webhook triggers, consider including specific test cases for various webhook scenarios.

  4. Documentation: Consider adding comments or documentation about how the webhook-triggered agent support works, especially for the new API endpoint /setup_webhook_trigger.

  5. Configuration Changes: If there are any configuration changes needed (especially for webhook handling), make sure .env.example and docker-compose.yml are updated accordingly.

The changes look promising and address an important feature, but they need more documentation and testing before they can be merged. Please update the PR with these items when you're ready for a more thorough review.

@Pwuts Pwuts force-pushed the pwuts/open-2523-explore-technical-implementation-for-webhook-triggered branch from 2118ef3 to 3781a07 Compare June 18, 2025 11:00
@AutoGPT-Agent
Copy link

Thank you for your PR working on webhook-triggered agent support!

I see this is marked as a Work in Progress (WIP), which explains the current state of the PR. Before this can be merged, you'll need to address the following:

  1. Please expand the PR description with details about the specific changes you're making. Just marking it as "WIP" isn't sufficient - explain what webhook-triggered agent support means and how your implementation works.

  2. Complete the checklist in the PR description. All applicable items need to be checked off.

  3. Consider whether the scope in your PR title is accurate. Your changes span both frontend and backend components (as indicated by the labels and the files changed), but the title only mentions 'platform/library'.

  4. Since you're modifying files in backend/data/, please ensure that any added or modified functions properly handle user_id checks, and note this in your description.

  5. Include a test plan that explains how you've verified your changes work correctly.

Please update the PR when it's no longer a work in progress and all these items have been addressed. Looking forward to seeing the completed implementation!

@AutoGPT-Agent
Copy link

Thank you for your PR on webhook-triggered agent support! I notice this is marked as WIP, but there are a few things that need attention before this can be merged:

  1. PR Description: Please provide a detailed description of what this feature does and how it works. The current description only mentions it's WIP and references an issue number.

  2. Checklist: None of the items in the checklist have been checked off. Please complete the checklist or mark which items are still in progress.

  3. Scope: Your PR title specifies platform/library, but the changes span across backend, frontend, and database schema. Consider whether the scope in the title accurately reflects the breadth of changes.

  4. User ID Verification: Since you're modifying files in backend/data/, please ensure that any added/changed functions properly handle user_id verification, or explain why it's not needed.

  5. Test Plan: Please outline how you've tested or plan to test this webhook functionality.

When you're ready to move this PR out of WIP status, please update the description with these details and complete the checklist. This will help reviewers understand the purpose and impact of your changes.

@AutoGPT-Agent
Copy link

Thank you for your PR adding webhook-triggered agent support! I notice this is marked as a Work in Progress, so here's some feedback to help guide you toward completion:

  1. Please complete the PR description with details about the specific changes you're making. The "Changes" section currently only contains "WIP" but should explain what functionality you're adding and how it works.

  2. There appears to be a mismatch between your PR title scope (platform/library) and the actual changes, which include both frontend and backend components (as indicated by the labels and file changes). Consider updating your PR title to better reflect the scope of changes.

  3. None of the checklist items are checked off yet. Please complete the checklist before requesting review, including:

    • Adding a clear test plan
    • Ensuring you've tested the changes
    • Checking that configuration files are updated if needed
  4. Since you're modifying files in backend/data/, please ensure any new or modified functions properly check user_id permissions where appropriate.

Please update your PR when it's ready for review, completing the description and checklist. Feel free to remove the WIP marker at that point.

@AutoGPT-Agent
Copy link

Thank you for your PR on adding Webhook-triggered Agent support. Since this is marked as a work in progress (WIP), I'm providing initial feedback before you finalize it:

  1. Complete the PR description: Please provide a detailed description of the changes you've made when this PR is ready for review. This should include what Webhook-triggered Agent support is, how it works, and the key components you've implemented.

  2. Fill out the checklist: None of the checklist items are currently checked. Please complete this when your PR is ready for review.

  3. Add a test plan: Include specific tests you've performed to verify the webhook functionality works as expected.

  4. Configuration changes: If your implementation requires any configuration changes (which seems likely for webhook integration), please document these in the PR description.

  5. Scope alignment: Your PR touches both frontend and backend code. Make sure all changes are related to the webhook-triggered agent support feature mentioned in the title.

Please update the PR when it's no longer a work in progress and ready for a thorough review. Looking forward to seeing the completed implementation.

@Pwuts Pwuts force-pushed the pwuts/open-2523-explore-technical-implementation-for-webhook-triggered branch 2 times, most recently from f9d0a80 to 9f0ee89 Compare June 19, 2025 15:19
@AutoGPT-Agent
Copy link

Thank you for your PR implementing webhook-triggered agent support. Since this is marked as a Work in Progress (WIP), I understand it's not ready for final review yet. Here's what you'll need to address before this can be merged:

  1. Complete the PR description:

    • Provide a detailed explanation of what changes you've made
    • Describe how webhook-triggered agent support works
    • List any configuration changes required
  2. Fill out the checklist:

    • All items in the checklist need to be checked off
    • Add a test plan specific to testing webhook functionality
  3. Configuration documentation:

    • Ensure any new environment variables are documented in .env.example
    • Update docker-compose.yml if needed

When you're ready for review, please mark the PR as ready and update the description accordingly. If you need any help or have questions during development, feel free to ask!

Looking forward to seeing the completed implementation of webhook-triggered agent support.

@AutoGPT-Agent
Copy link

Thank you for starting work on webhook-triggered agent support. I notice this PR is marked as WIP, which is fine, but there are several items that need to be addressed before it can be considered for merging:

  1. Please expand the PR description to include more details about the specific changes you're making. Even for a WIP PR, it's helpful to outline what you've implemented so far and what's still pending.

  2. None of the checklist items have been completed yet. Please check them off as you progress through the implementation.

  3. Since you're modifying files in backend/data/, please ensure any new or modified functions properly handle user_id checks for security purposes.

  4. Consider adding a test plan specific to webhook functionality to demonstrate how you'll verify the implementation works as expected.

  5. If you've added any new environment variables or configuration requirements for the webhook functionality, please document these in the PR description.

I'm marking this as a failure not because there's anything wrong with the code itself (which I haven't reviewed in detail), but because the PR as currently submitted is explicitly a work in progress and not ready for final review. Please feel free to update the PR when you're further along, and I'll be happy to review it again.

@Pwuts Pwuts force-pushed the pwuts/open-2523-explore-technical-implementation-for-webhook-triggered branch from 9f0ee89 to 659999d Compare June 19, 2025 15:21
@AutoGPT-Agent
Copy link

Thank you for this comprehensive PR that adds support for webhook-triggered agents in the Library! The changes look well-structured across the entire stack.

However, before we can merge this PR, please complete the test plan you've outlined. Specifically, you still need to test:

  • Setting up a trigger in the Library
  • Updating a trigger in the Library
  • Disabling and re-enabling a trigger in the Library
  • Deleting a trigger in the Library
  • Verifying that triggers set up in the Library result in a new run when the webhook receives a payload

These tests are crucial to ensure that the new functionality works as expected. Please complete them and check them off in the PR description.

Additionally, I notice this is a large PR that touches multiple parts of the codebase. Once you've completed the testing, it would be helpful to have a brief summary of the test results to give reviewers confidence in the changes.

Let me know if you encounter any issues while testing or if you need any clarification!

@AutoGPT-Agent
Copy link

Thanks for this comprehensive PR adding triggered-agent support to the Library! I appreciate the detailed explanation and clear organization of your changes.

A few points to address before merging:

  1. Test Plan Completion: It looks like you've only partially completed the test plan you outlined. Several items are still unchecked:

    • Setting up a trigger in the Library
    • Updating a trigger in the Library
    • Disabling and re-enabling a trigger in the Library
    • Deleting a trigger in the Library

    Please ensure you've tested all these scenarios before we proceed with merging.

  2. PR Title Scope: Your changes span frontend, backend, and blocks components (as indicated by the labels), but the title only mentions platform/library. Consider updating the title to better reflect the full scope of changes, perhaps using a more general scope like platform instead.

  3. User ID Checks: You mentioned adding user_id checks to various DB functions. Can you confirm that all added/changed functions in backend/data/*.py properly pass and check the user_id?

Once these points are addressed, this looks like a valuable addition to enable triggered agents in the Library. The implementation seems comprehensive across the stack.

@AutoGPT-Agent
Copy link

Thank you for this comprehensive PR adding triggered-agent support to the Library! The implementation looks thorough, spanning the entire stack from frontend to backend.

Main feedback:

  1. Incomplete test plan: Your checklist shows you haven't completed testing for several key functionality items:

    • Setting up a trigger in the Library
    • Updating a trigger in the Library
    • Disabling and re-enabling a trigger in the Library
    • Deleting a trigger in the Library

    Please complete this testing before the PR can be merged.

  2. Scope clarification: The PR title specifies "platform/library" but includes significant changes across frontend, backend, and blocks components. While these changes are necessary for the feature, consider a more comprehensive scope in the PR title such as "feat(platform): Triggered-agent support in Library" to better reflect the breadth of changes.

  3. Frontend routes: Could you confirm whether any new base routes requiring protection have been added? If so, please ensure lib/supabase/middleware.ts protections are updated accordingly.

  4. Backend data changes: I notice you've made changes to several files in backend/data/. You mention adding user_id checks to various DB functions - can you highlight specific examples in a comment to help reviewers verify this security aspect?

Overall, this is a valuable addition that will make triggered agents more accessible. Once you've completed the testing items and addressed these points, this PR should be ready for another review.

@Pwuts Pwuts force-pushed the pwuts/open-2523-explore-technical-implementation-for-webhook-triggered branch from c160f1b to 9a5aec8 Compare June 24, 2025 09:25
@AutoGPT-Agent
Copy link

Thank you for your detailed PR! The changes to add triggered-agent support to the Library look comprehensive and well-structured. I have a few concerns before we can merge:

Testing

Your test plan looks thorough, but you've only completed testing for existing functionality and one aspect of the new functionality. Could you please complete testing for the remaining items:

  • Setting up a trigger in the Library
  • Updating a trigger in the Library
  • Disabling and re-enabling a trigger in the Library
  • Deleting a trigger in the Library

PR Title Scope

Your changes span across multiple platform components (frontend, backend, blocks) as indicated by both the file changes and the labels. The current title feat(platform/library) doesn't fully represent this scope. Consider updating it to something like feat(platform): Triggered-agent support in Library to more accurately reflect the breadth of changes.

User ID Handling

I noticed changes to several files in backend/data/. Could you confirm that any modified or added functions in these files properly handle user_id validation for security purposes?

Once these items are addressed, we should be good to go with this PR. The implementation looks solid and will be a valuable addition to the platform!

@AutoGPT-Agent
Copy link

Thank you for this detailed PR adding webhook-triggered agent support to the Library! The implementation looks comprehensive, spanning the entire stack from frontend to backend.

Incomplete Testing

I noticed that several items in your test plan remain unchecked:

  • Updating a trigger in the Library
  • Disabling and re-enabling a trigger in the Library
  • Deleting a trigger in the Library

Before this PR can be merged, please complete this testing to ensure the functionality works as expected.

Additional Feedback

  • Your PR description is clear and comprehensive, which helps a lot with understanding the scope and intent of these changes.
  • The feature itself looks valuable - moving triggered agent setup from Builder-only to the Library will definitely improve usability.
  • The changes to add user_id checks to DB functions are important for security.

Once you've completed testing of all the functionality listed in your test plan, please update the checklist and this PR should be ready for another review.

@AutoGPT-Agent
Copy link

Thank you for this comprehensive PR that adds triggered-agent support to the Library! The documentation and description of changes are excellent.

However, I noticed that your test plan indicates two items are still unchecked:

  • Updating a trigger in the Library
  • Disabling and re-enabling a trigger in the Library

Before we can approve this PR, please complete testing for these items to ensure the full functionality works as expected. This is especially important for a feature that spans across the entire stack.

A few other minor points to consider:

  1. The PR is labeled with both platform/frontend, platform/backend, and platform/blocks, which matches the changes across the stack, but the title scope is "platform/library". Consider whether this is the most accurate scope designation or if it should be broadened to "platform".

  2. You've mentioned adding user_id checks to various DB functions, which is good. Please ensure that all new or modified data access functions properly validate user permissions.

Once you've completed the remaining test items, this PR will be ready for another review. Great work on this substantial feature addition!

@AutoGPT-Agent
Copy link

Thank you for submitting this comprehensive PR for triggered-agent support in the Library! The changes look well-structured and the description is thorough.

A few things to address before we can merge:

  1. Incomplete testing: According to your checklist, you haven't verified these items yet:

    • Updating a trigger in the Library
    • Disabling and re-enabling a trigger in the Library

    Please complete these tests to ensure all functionality works as expected.

  2. Wide scope: While your PR is labeled appropriately (frontend, backend, blocks), the title only mentions platform/library. Consider if a more general scope like "platform" might better reflect the breadth of changes.

  3. Backend data changes: I notice you've added user_id checks to various DB functions, which is good. Could you highlight specific examples in your description of where these security improvements were made?

Overall this looks like a valuable addition that will significantly improve the platform's capabilities. Once you've completed the remaining test items, this should be ready for final review.

@AutoGPT-Agent
Copy link

Thank you for this detailed PR implementing triggered-agent support in the Library! The description and implementation look comprehensive, covering changes across the entire stack.

I noticed one issue that needs to be addressed before we can approve this PR:

  • Your test plan checklist is not completely checked off. Specifically, the "Disabling and re-enabling a trigger in the Library" item is unchecked. Please either complete this test or provide an explanation for why it wasn't tested.

A few additional points to consider:

  1. Since there are changes to backend/data files, please confirm that all the added/modified functions are properly checking user_id for authentication.

  2. The PR makes significant changes across multiple parts of the codebase. Have you considered any potential backward compatibility issues, especially for existing triggered agents created in the Builder?

  3. The screenshot is helpful, but it might be useful to add some basic documentation on how the new trigger functionality works from a user perspective.

Once you've addressed the checklist issue, we'll be able to proceed with the review.

@Pwuts Pwuts enabled auto-merge June 24, 2025 10:01
@github-actions github-actions bot added platform/blocks conflicts Automatically applied to PRs with merge conflicts labels Jun 24, 2025
Copy link
Contributor

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

1 similar comment
Copy link
Contributor

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

@Pwuts Pwuts requested a review from ntindle June 24, 2025 15:55
ntindle
ntindle previously approved these changes Jun 24, 2025
Copy link
Contributor

Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly.

@github-actions github-actions bot removed the conflicts Automatically applied to PRs with merge conflicts label Jun 24, 2025
@Pwuts Pwuts requested a review from ntindle June 24, 2025 16:14
Copy link
Contributor

@majdyz majdyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the missing approval stamp from backend

)


# Fix Webhook <- NodeModel relations
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any clarity on what the fix would be?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 👍🏼 Mergeable
Status: No status
Development

Successfully merging this pull request may close these issues.

4 participants