Skip to content

Environment Generator

EnvGenerator produces a validated .env file from your workflow and agent configuration.

meshflow env-gen workflow.yaml --out .env.production

Python API

from meshflow import EnvGenerator, ValidationIssue

gen = EnvGenerator()
env_str, issues = gen.generate_from_yaml("workflow.yaml")

for issue in issues:
    v: ValidationIssue = issue
    print(f"[{v.severity}] {v.key}: {v.message}")

# Write to file
with open(".env.production", "w") as f:
    f.write(env_str)

Generated output example

# Generated by meshflow env-gen — 2026-05-30
# Workflow: research-pipeline

# Required — LLM provider
ANTHROPIC_API_KEY=

# Required — Ledger storage
MESHFLOW_DB_PATH=meshflow_runs.db

# Optional — Token optimization
MESHFLOW_MODEL=claude-sonnet-4-6
MESHFLOW_RATE_LIMIT_RPS=10
MESHFLOW_RATE_LIMIT_BURST=20

# Optional — OTEL tracing
MESHFLOW_OTLP_ENDPOINT=

# Optional — Tenant isolation
MESHFLOW_DEFAULT_TENANT=default

# Optional — Mock mode (set to 1 for offline testing)
MESHFLOW_MOCK=

ValidationIssue severity

Severity Meaning
error Required variable missing — deployment will fail
warning Recommended variable not set
info Optional variable with a suggested default