Code Execution troubleshooting

This section provides common issues and their solutions when working with the Agent Engine Code Execution .

Sandbox creation issues

  • Permissions error:If you encounter errors when creating a sandbox, ensure your Google Cloud project has the Vertex AI User (roles/aiplatform.user) Identity and Access Management (IAM) role.

  • Invalid Project ID or Location:Verify that the PROJECT_ID and LOCATION variables used in your code are correct and supported. For a list of supported regions, see Supported regions .

  • Agent Engine not created:Before creating a sandbox, confirm that the Agent Engine instance was successfully created. The agent_engine.create() method must complete without errors.

Code execution issues

  • Code errors:Review the stderr output from the execute_code response to identify any syntax errors, runtime exceptions, or logical flaws in your code.

  • File I/O issues:

    • File not found:Ensure that any input files specified in the files array of your input_data are correctly referenced within your code. Your code is executed in the same folder as the files and can't access other folders.

    • Output file not generated:Check that your code is writing to the expected output filename and that there are no errors preventing file creation or writing.

    • Size limits:There is a 100MB size limit for files.

  • State persistence:If your code relies on previous state, verify that you are using the same sandbox_name for subsequent calls. Also, make sure that the sandbox has not expired.

  • Timeout:Code execution times out after 300 seconds. Consider optimizing your code for performance or breaking down complex tasks into smaller, more manageable steps.

Sandbox management and cleanup

  • Sandbox not found for deletion:If you're unable to delete a sandbox, ensure that the sandbox_name you are using is correct and that the sandbox still exists.

  • Agent Engine not found for deletion:Similar to sandboxes, verify the agent_engine_name when attempting to delete the Agent Engine.

  • Resource quotas:If you are creating many sandboxes or performing frequent executions, you might encounter resource quota limits. Check your project's quotas for Vertex AI services and request increases if necessary. For a list of Agent Engine quotas, see Quotas .

Create a Mobile Website
View Site in Mobile | Classic
Share by: