Skip to content

fix: render .env.example template in agentex init#351

Merged
danielmillerp merged 1 commit intomainfrom
dm/init-render-env-example
May 8, 2026
Merged

fix: render .env.example template in agentex init#351
danielmillerp merged 1 commit intomainfrom
dm/init-render-env-example

Conversation

@danielmillerp
Copy link
Copy Markdown
Contributor

@danielmillerp danielmillerp commented May 8, 2026

Summary

  • The .env.example.j2 template file was added to every template directory but never wired into init.py, so generated projects silently lacked a .env.example.
  • Adds .env.example.j2.env.example to the root_templates dict so every template type emits the file.
  • Fixes the friction where users have to put LITELLM_API_KEY directly into manifest.yaml because there's no obvious place to put it locally.

Test plan

  • Run agentex init for each template type (sync, sync-openai-agents, sync-langgraph, default, default-langgraph, temporal, temporal-openai-agents) and confirm .env.example appears in the project root with the expected LITELLM_API_KEY= / commented OPENAI_BASE_URL= placeholders
  • Confirm rendered .env.example substitutes {{ agent_name }} correctly in the header comment

🤖 Generated with Claude Code

Greptile Summary

Wires the pre-existing .env.example.j2 template into the root_templates dict in create_project_structure, so every agentex init run now emits a .env.example file in the project root. All 7 template directories already contained identical .env.example.j2 files, and the {{ agent_name }} placeholder resolves correctly from the existing context dict.

Confidence Score: 5/5

Safe to merge — minimal, correct one-line fix with all template files already in place.

Single-line addition to a dict; template files exist in all 7 template directories, the Jinja2 variable resolves correctly, and there are no side effects or regressions.

No files require special attention.

Important Files Changed

Filename Overview
src/agentex/lib/cli/commands/init.py Single-line addition to root_templates dict; correct and complete — all 7 template directories have the corresponding .env.example.j2 file and the agent_name context variable is already provided.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[agentex init] --> B[User selects template type]
    B --> C[create_project_structure]
    C --> D[Render project/ files\nacp.py, workflow.py, etc.]
    C --> E[Render root_templates]
    E --> F[.dockerignore]
    E --> G[.env.example NEW]
    E --> H[manifest.yaml]
    E --> I[README.md]
    E --> J[environments.yaml]
    E --> K[Dockerfile / pyproject.toml]
    E --> L[dev.ipynb]
    G --> M[Written to project root\nwith agent_name substituted]
Loading

Fix All in Cursor Fix All in Claude Code Fix All in Codex

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
src/agentex/lib/cli/commands/init.py:293-299
**Post-init guidance doesn't mention the new `.env.example`**

The PR's stated goal is to reduce friction around `LITELLM_API_KEY` setup, but the "Development Setup" step 3 only shows `uv venv && uv sync && source .venv/bin/activate` without prompting users to copy `.env.example``.env` and fill in the key. A user who doesn't notice the generated file would still hit the same friction. Adding a line like `cp .env.example .env  # then add your LITELLM_API_KEY` here would close the loop.

Reviews (1): Last reviewed commit: "fix: render .env.example template in age..." | Re-trigger Greptile

The .env.example.j2 template file exists in every template directory but
was missing from the root_templates dict in init.py, so it was silently
dropped during project generation. Add it so generated projects include
a .env.example with LITELLM_API_KEY and OPENAI_BASE_URL placeholders,
guiding users to put credentials in .env instead of manifest.yaml.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

This PR is targeting main, but PRs should target the next branch by default.

The main branch is reserved for release-please and Stainless automation. To resolve, pick one of:

  • Re-target the PR to next (recommended). On the PR page, click Edit next to the title and change the base branch to next.
  • Add the target-main label if this is an intentional exception (e.g. an urgent hotfix). The check will re-run and pass.

See CONTRIBUTING.md for the full branch model.

@danielmillerp danielmillerp merged commit 6092595 into main May 8, 2026
32 of 34 checks passed
@danielmillerp danielmillerp deleted the dm/init-render-env-example branch May 8, 2026 18:27
@stainless-app stainless-app Bot mentioned this pull request May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant