Summary
Handler can attach custom headers to requests only programmatically (AuthCredentials.custom_headers); there's no way to set arbitrary per-server headers from the config TOML (or CLI/TUI). Add a [servers.<name>.headers] table so users can attach static custom headers to every request to a server.
Motivation
Many A2A servers key behavior off custom request headers that aren't auth credentials — e.g. a per-user memory scope (X-Remy-User), tenant ids, feature flags, or trace ids. Today setting one requires code; config-level support makes it usable straight from the CLI/TUI.
Concretely: I gave an A2A agent (Remy, on Cloud Run) per-user long-term memory keyed off an X-Remy-User header, and wanted to set it per-server in Handler config rather than editing code.
Proposed config
[servers.remy]
url = "http://localhost:8080/a2a-local"
[servers.remy.headers]
X-Remy-User = "alice"
X-Trace-Id = "abc123"
These merge into the outgoing request headers for both agent-card fetch and message send. Precedence: auth headers (from [servers.<name>.auth]) win on conflict — or document whichever you choose. Consider supporting env:VAR value resolution to match the auth config's env pattern.
Implementation notes
- Extend
ServerDefinition (+ TOML parsing) in src/a2a_handler/servers.py with an optional headers: dict[str, str].
- Apply them where auth headers are set on the httpx client (
src/a2a_handler/service.py, around _apply_auth_headers / http_client.headers.update).
- Surface them (read/edit) in the TUI Headers tab.
Related
Complements #81 (native GCP/Cloud Run auth): headers cover non-credential app-level context; #81 covers verified identity.
Summary
Handler can attach custom headers to requests only programmatically (
AuthCredentials.custom_headers); there's no way to set arbitrary per-server headers from the config TOML (or CLI/TUI). Add a[servers.<name>.headers]table so users can attach static custom headers to every request to a server.Motivation
Many A2A servers key behavior off custom request headers that aren't auth credentials — e.g. a per-user memory scope (
X-Remy-User), tenant ids, feature flags, or trace ids. Today setting one requires code; config-level support makes it usable straight from the CLI/TUI.Concretely: I gave an A2A agent (Remy, on Cloud Run) per-user long-term memory keyed off an
X-Remy-Userheader, and wanted to set it per-server in Handler config rather than editing code.Proposed config
These merge into the outgoing request headers for both agent-card fetch and message send. Precedence: auth headers (from
[servers.<name>.auth]) win on conflict — or document whichever you choose. Consider supportingenv:VARvalue resolution to match the auth config'senvpattern.Implementation notes
ServerDefinition(+ TOML parsing) insrc/a2a_handler/servers.pywith an optionalheaders: dict[str, str].src/a2a_handler/service.py, around_apply_auth_headers/http_client.headers.update).Related
Complements #81 (native GCP/Cloud Run auth): headers cover non-credential app-level context; #81 covers verified identity.