Significant-Gravitas / AutoGPT

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
https://agpt.co
Other
168.53k stars 44.47k forks source link

fix(backend): Re-work the connection input consumption logic for Agent Executor Block #8710

Closed majdyz closed 1 day ago

majdyz commented 3 days ago

Agent Executor Block puts all the data within the data field of the input. And the rest of the input is metadata. The current implementation only validates the input of block input (which is the metadata), but not validating the data value against the schema of the graph.

This makes the graph always executed once there is a trigger input, without waiting the inbound connection data and uses the default value.

Issue Repro:

Changes πŸ—οΈ

Add a graph input schema validation to the graph to force the execution to wait for all the connecting input fields are completed and provided.

image

Checklist πŸ“‹

For code changes:

Example test plan - [ ] Create from scratch and execute an agent with at least 3 blocks - [ ] Import an agent from file upload, and confirm it executes correctly - [ ] Upload agent to marketplace - [ ] Import an agent from marketplace and confirm it executes correctly - [ ] Edit an agent from monitor, and confirm it executes correctly

For configuration changes:

Examples of configuration changes - Changing ports - Adding new services that need to communicate with each other - Secrets or environment variable changes - New or infrastructure changes such as databases
codiumai-pr-agent-pro[bot] commented 3 days ago

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

Error Handling
The error handling in validate_exec() function could be improved. The function returns None and error message in multiple places but the error messages have inconsistent formats and prefixes. Code Duplication
The validation logic for required fields and schema validation is duplicated between the AgentExecutorBlock case and the regular case. Consider extracting common validation logic into a helper function. Type Safety
The type conversion in the non-AgentExecutorBlock case assumes the conversion will always succeed. Should add error handling around the convert() function call.
netlify[bot] commented 3 days ago

Deploy Preview for auto-gpt-docs canceled.

Name Link
Latest commit 6378beadb364afac387829a4ee282887a83715a4
Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/673f12d5cc13ac0008596364
Torantulino commented 3 days ago

Working on my end!

majdyz commented 2 days ago

@Pwuts addressed your comment, pls re-review πŸ™