Disconnect
Closes an active Vertex AI connection and releases associated resources.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
info
If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.
Inputs
- Connection Id - Vertex AI client session identifier from Connect node to be closed.
Output
No output from this node.
How It Works
The Disconnect node terminates an active Vertex AI connection and cleans up resources. When executed:
- Retrieves the Connection ID from input
- Validates that Connection ID is not empty
- Removes the stored authentication token and project ID
- Releases the connection from the internal connection pool
- Invalidates the Connection ID for future use
After disconnection, the Connection ID can no longer be used with any Vertex AI nodes.
Requirements
- Valid Connection ID from a Connect node
- Connection must not have been previously disconnected
Error Handling
Common errors and solutions:
| Error | Cause | Solution |
|---|---|---|
| ErrInvalidArg | Empty Connection ID | Provide a valid Connection ID from Connect node |
| Connection not found | Connection already closed or never existed | Verify Connection ID is correct and still active |
Example Use Cases
Basic Cleanup Pattern
Flow:
1. Connect → Get Connection ID
2. Generate Text (use Connection ID)
3. Generate Chat (use Connection ID)
4. Disconnect (cleanup)
Error-Safe Disconnection
Try-Catch Pattern:
Try:
- Connect
- Vertex AI Operations
Catch:
- Log Error
Finally:
- Disconnect (in Continue On Error mode)
Conditional Disconnection
Loop Processing:
1. Connect outside loop
2. Loop: Process items with Vertex AI
3. After loop: Disconnect
Benefit: Reuses connection, disconnects once
Tips
- Resource Management: Always disconnect when workflow completes
- Error Handling: Use in Finally block to ensure cleanup
- Connection Reuse: Disconnect only after all operations complete
- Long-Running Flows: For flows running hours, consider periodic reconnection
- Multiple Connections: Track different Connection IDs if using multiple projects
- Optional Step: Disconnection is optional - connections auto-cleanup on flow end
- Performance: For high-frequency automations, consider connection pooling strategies
When to Disconnect
Disconnect when:
- All Vertex AI operations are complete
- Switching to a different Google Cloud project
- Ending a long-running automation workflow
- Implementing proper resource cleanup patterns
- Testing connection lifecycle management
Skip disconnection when:
- Flow ends immediately after last Vertex AI operation (auto-cleanup)
- You want to reuse the connection in subsequent workflow runs
- Implementing connection pooling for performance
Best Practices
- Use Disconnect in Finally blocks for guaranteed cleanup
- Don't disconnect in the middle of operations that share a connection
- For batch processing, disconnect after processing all items
- Monitor connection lifecycle in logs for debugging
- Implement reconnection logic for long-running automations
- Use Continue On Error = true for Disconnect nodes to prevent workflow failures
- Document connection lifecycle in workflow comments
- Test disconnection behavior in error scenarios