Skip to content

feat: scaffold full atlas config from env init#75

Merged
jbarnes850 merged 2 commits intomainfrom
codex/extend-atlas-env-init-for-full-config-generation
Oct 23, 2025
Merged

feat: scaffold full atlas config from env init#75
jbarnes850 merged 2 commits intomainfrom
codex/extend-atlas-env-init-for-full-config-generation

Conversation

@jbarnes850
Copy link
Copy Markdown
Contributor

@jbarnes850 jbarnes850 commented Oct 23, 2025

This pull request introduces several improvements to Atlas's environment discovery, configuration scaffolding, and LLM mocking capabilities. The main focus is on making the CLI more robust and user-friendly, especially for complex agent stacks and offline validation workflows. Key changes include enhanced .env loading, automatic Python path adjustments, provider/model autodiscovery, and the ability to run smoke tests with a fake LLM.

Environment and Configuration Discovery Improvements:

  • The CLI now loads .env files from the project root and automatically adjusts PYTHONPATH to include both the project root and src directory, reducing manual setup for most stacks. (atlas/cli/run.py, atlas/utils/env.py, README.md) [1] [2] [3]
  • Discovery auto-loads .env before spinning up factories and derives additional import hints from passed factories, streamlining agent/environment initialization. (README.md)

LLM Provider and Model Autodiscovery:

  • Added recursive introspection logic to automatically detect LLM provider and model metadata from agent objects, supporting LangChain and custom stacks. This metadata is now included in the discovery payload. (atlas/sdk/discovery_worker.py) [1] [2] [3] [4]

LangChain Compatibility and Workarounds:

  • Introduced a workaround to patch LangChain's pydantic helpers for better compatibility with wrapped tools and injected fields, preventing common errors in complex agent setups. (atlas/sdk/discovery_worker.py) [1] [2]

Offline Validation and LLM Mocking:

  • Added support for the ATLAS_FAKE_LLM=1 environment variable, which enables mock LLM responses for offline validation and smoke testing without calling live providers. (atlas/utils/llm_client.py, README.md) [1] [2] [3] [4] [5]

Testing and Reliability:

  • Added an integration test to verify that environment initialization scaffolds a runnable config, loads .env variables, and works with the mock LLM for smoke tests. (tests/integration/test_env_ready_config.py)

These changes collectively improve Atlas's developer experience, reliability, and support for advanced agent stacks and offline workflows.

@jbarnes850
Copy link
Copy Markdown
Contributor Author

✅ Ready-to-run scaffolding overhaul is in. Highlights:

  • Full config generator now builds clean Python adapter blocks and preserves template prompts/tools while injecting discovered LLM metadata.
  • atlas env init auto-loads project .env, infers PYTHONPATH hints, and surfaces actionable failure guidance; the discovery worker now honors those overrides (and patches LangChain schema access).
  • atlas run mirrors that bootstrap path so the generated config executes immediately.
  • New integration test spins up a demo repo and exercises atlas env init --scaffold-config-full followed by atlas run under ATLAS_FAKE_LLM.

CI / smoke:

pytest
ATLAS_MOCK_AUTH0=1 ATLAS_FAKE_LLM=1 atlas env init --path external/auth0-assistant0/py-langchain/backend --env-fn examples.langgraph_adapter:create_environment --agent-fn examples.langgraph_adapter:create_langgraph_agent --env-arg graph=app.agents.assistant0:agent --agent-arg graph=app.agents.assistant0:agent --scaffold-config-full --force --no-run
ATLAS_FAKE_LLM=1 atlas run --path external/auth0-assistant0/py-langchain/backend --config external/auth0-assistant0/py-langchain/backend/.atlas/generated_config.yaml --task "Smoke task"

Let me know if you want additional coverage or docs tweaks.

@jbarnes850 jbarnes850 marked this pull request as ready for review October 23, 2025 21:16
Copilot AI review requested due to automatic review settings October 23, 2025 21:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a --scaffold-config-full flag for atlas env init that generates a complete, runnable Atlas configuration by merging template defaults with discovered factory metadata and inferred LLM provider/model information.

Key Changes:

  • Auto-detection of LLM provider/model from LangChain-based agents during discovery
  • Full YAML config scaffolding with discovery metadata, LLM parameters, and template defaults
  • .env file auto-loading and intelligent PYTHONPATH inference during discovery
  • Mock LLM mode (ATLAS_FAKE_LLM=1) for offline testing

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/unit/test_env_scaffold.py Unit tests for LLM metadata detection and full config composition logic
tests/integration/test_env_ready_config.py Integration test verifying end-to-end scaffolding and config execution
atlas/sdk/discovery_worker.py LLM metadata detection, LangChain workarounds, and environment/PYTHONPATH handling
atlas/cli/env.py Full config scaffolding, auto-candidate selection, and .env loading logic
atlas/utils/llm_client.py Mock LLM response implementation for offline testing
atlas/utils/env.py Extended dotenv loader to accept optional path parameter
atlas/cli/run.py Updated to load .env and configure sys.path
tests/unit/test_cli_run.py Updated mock to accept variable arguments
README.md Documentation for new scaffolding flag and features

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread atlas/cli/env.py
Comment thread atlas/cli/env.py
Comment thread atlas/sdk/discovery_worker.py
Comment thread atlas/cli/env.py
@jbarnes850 jbarnes850 added enhancement New feature or request and removed codex labels Oct 23, 2025
@jbarnes850 jbarnes850 merged commit a6f02ff into main Oct 23, 2025
1 check passed
@github-project-automation github-project-automation Bot moved this from In progress to Done in Arc Project Board & Issue Tracker Oct 23, 2025
@jbarnes850 jbarnes850 deleted the codex/extend-atlas-env-init-for-full-config-generation branch October 23, 2025 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Development

Successfully merging this pull request may close these issues.

2 participants