Skip to content

feat: add support for env_vars to ReasoningEngine.create#6622

Open
EaCognitive wants to merge 3 commits intogoogleapis:mainfrom
EaCognitive:feat-reasoning-engine-env-vars
Open

feat: add support for env_vars to ReasoningEngine.create#6622
EaCognitive wants to merge 3 commits intogoogleapis:mainfrom
EaCognitive:feat-reasoning-engine-env-vars

Conversation

@EaCognitive
Copy link
Copy Markdown

Problem

The ReasoningEngine.create method in the Vertex AI SDK currently lacks support for passing environment variables (env_vars) to the reasoning engine at creation time. This is a fundamental requirement for many LangChain-based agents that rely on environment variables for configuration and secrets. While the newer AgentEngine class supports this, ReasoningEngine has fallen behind in feature parity.

Solution

This PR adds support for env_vars to ReasoningEngine.create. It also refactors the shared deployment specification logic into a new _utils.py module to ensure consistent behavior across both AgentEngine and ReasoningEngine.

Changes

  • Created vertexai/reasoning_engines/_utils.py to host shared deployment specification helper functions.
  • Updated vertexai/reasoning_engines/_reasoning_engines.py to accept and pass the env_vars parameter during resource creation.
  • Aligned ReasoningEngine with the AgentEngine implementation pattern.

Verification

  • Verified that env_vars are correctly mapped into the ReasoningEngineSpec.DeploymentSpec.
  • Consistent with established SDK patterns.

@EaCognitive EaCognitive requested a review from a team as a code owner April 21, 2026 17:10
@product-auto-label product-auto-label Bot added size: l Pull request size is large. api: vertex-ai Issues related to the googleapis/python-aiplatform API. labels Apr 21, 2026
@product-auto-label product-auto-label Bot added size: m Pull request size is medium. and removed size: l Pull request size is large. labels Apr 24, 2026
@EaCognitive
Copy link
Copy Markdown
Author

Updated with current main and re-ran targeted coverage. Local validation: uv run ... pytest tests/unit/vertex_langchain/test_reasoning_engines.py -k 'test_create_reasoning_engine_with_env_vars or test_generate_deployment_spec' -> 6 passed. The branch preserves existing Reasoning Engine utilities and adds env var name, direct value, SecretRef, invalid type, and missing env-var coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: vertex-ai Issues related to the googleapis/python-aiplatform API. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant