ductor icon indicating copy to clipboard operation
ductor copied to clipboard

[Feature]: Support external API secrets across host and Docker runtimes

Open liuh886 opened this issue 8 months ago • 1 comments

Problem or motivation

Problem

Ductor appears to support some provider-specific config fields such as gemini_api_key, but it does not provide a general way to manage external API secrets used by project code, such as:

• PPLX_API_KEY • DEEPSEEK_API_KEY

In mixed host + Docker setups, this causes runtime inconsistency:

• the orchestrator/bot process may run on the host • CLI execution may run inside Docker • project code reads secrets from os.environ • but those variables are not automatically available in the actual execution environment

For example, having values in ~/.ductor/.env is not enough by itself if Ductor does not load and propagate them.

Expected behavior

Ductor should provide a documented, first-class mechanism for external API secrets that works consistently for:

• main bot • sub-bots • background tasks • host execution • Docker execution

Proposed solution

Suggested direction

Instead of adding one config field per provider, support a general secret source, for example:

• ~/.ductor/.env • or config.json with a generic map such as external_api_keys

Then propagate a whitelist of allowed variables into:

• host subprocess execution • Docker container runtime • docker exec sessions

Why this matters

Mounted files may be available, but env-based credentials are still missing. This makes project code fail even when the business logic is correct.

Acceptance criteria

• define external API secrets once • available in host execution • available in Docker execution • inherited by main bot, sub-bots, and tasks • whitelist-based propagation for safety • documented behavior and precedence rules

If you want, I can also give you a one-paragraph PR description to match this issue.

Alternatives considered

No response

Before submitting

  • [x] I have searched existing issues and feature requests for duplicates.

liuh886 avatar Mar 07 '26 13:03 liuh886

Implemented in 7f136e5 + cb78dc2.

How it works: Create ~/.ductor/.env with standard dotenv syntax:

PPLX_API_KEY=sk-xxx
DEEPSEEK_API_KEY=sk-yyy
export MY_VAR="quoted value"

Secrets are injected at three points:

  • Host subprocess execution (_build_subprocess_env)
  • Docker exec sessions (docker_wrap)
  • Docker container creation (_start_container)

Works across main bot, sub-agents, and background tasks. Existing env vars are never overridden. Provider-specific config (e.g. gemini_api_key) takes precedence.

Edits to .env are picked up automatically on the next CLI invocation (mtime-based hot-reload, no restart needed).

PleasePrompto avatar Mar 08 '26 03:03 PleasePrompto