Skip to content

[Bug]: Environment variable interpolation ${ANTHROPIC_API_KEY} not working in agent-compose.yml #20

@Mr-Toby

Description

@Mr-Toby

Summary

When using ${ANTHROPIC_API_KEY} syntax in agent-compose.yml env section, the CLI fails to read the shell environment variable and reports "environment variable ANTHROPIC_API_KEY is required", even when the variable is properly set in the shell.

Steps to reproduce

Set environment variable: export ANTHROPIC_API_KEY="sk-ant-xxx"
Create agent-compose.yml with env section:

agents:
claude-agent:
provider: claude
env:
ANTHROPIC_API_KEY: "${ANTHROPIC_API_KEY}"
Run ./agent-compose up
Observe error: validate compose field agents.claude-agent.env.ANTHROPIC_API_KEY.value: environment variable ANTHROPIC_API_KEY is required

Expected behavior

The CLI should correctly interpolate ${ANTHROPIC_API_KEY} from the shell environment variable and apply the configuration successfully.

Actual behavior

CLI reports environment variable is required, even though it's set in the shell:

/root/agent-compose-v2606.1.0-linux-amd64/agent-compose.yml: validate compose field agents.claude-agent.env.ANTHROPIC_API_KEY.value: environment variable ANTHROPIC_API_KEY is required
Workaround: Write the value directly in YAML instead of using ${} syntax.

Version or commit

No response

Runtime driver

None

Logs


Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions