Skip to content

feat: support --remote-config for loading config from URL #80

@neilkuan

Description

@neilkuan
Summary

Support loading config from a remote URL by auto-detecting URL in the existing positional argument:

# local (existing behavior, unchanged)
agent-broker config.toml

# remote (new — auto-detected by http:// or https:// prefix)
agent-broker https://example.com/config.toml
Motivation

Currently the broker only reads config from a local file path (defaults to ./config.toml). In containerized or multi-node deployments, it's common to host a shared config on a central server (e.g. S3, internal HTTP service, Git raw URL). Auto-detecting URLs in the existing positional arg removes the need to pre-download or mount the file manually, while keeping the CLI simple — no extra flags needed.

Proposed Behavior
  • If the positional config arg starts with http:// or https://, fetch the TOML content via HTTP(S) GET before parsing.
  • Otherwise, treat the arg as a local file path (existing behavior, unchanged).
  • No separate --remote-config flag — the daemon just takes one config source and it can be either a path or a URL.
  • Existing env-var expansion (${VAR}) should still work on the fetched content.
  • Reasonable timeout (e.g. 10s) and clear error message on fetch failure.
Design Rationale

agent-broker is a daemon (starts and stays running), not a client CLI. This is more like dockerd / kubelet — it starts up with a config and runs. A kubectl apply -f-style subcommand structure fits client tools better. Future client-side subcommands (e.g. session management) would be a separate concern (agent-broker-ctl or similar).

Implementation Notes
  • Add reqwest dependency
  • In main.rs, check if the arg starts with http:// / https:// → fetch, otherwise → read_to_string
  • Same expand_env_vars + toml::from_str pipeline either way
  • 10s timeout + clear error on fetch failure
  • Works with S3 pre-signed URLs, raw GitHub URLs, etc. — anything that returns TOML over HTTP(S)
Acceptance Criteria
  • agent-broker https://... fetches and uses remote config via auto-detection
  • Env-var expansion works on remote config content
  • Clear error on network failure / non-200 response / invalid TOML
  • Existing local file config path remains the default behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions