diff --git a/docs/architecture/credential-injection.md b/docs/architecture/credential-injection.md index 0dfb9cbe1a..a667a59257 100644 --- a/docs/architecture/credential-injection.md +++ b/docs/architecture/credential-injection.md @@ -1,6 +1,6 @@ # Credential Injection -The gateway sidecar injects credentials at the proxy layer, ensuring the sandbox container has zero credential access. This covers GitHub (via git wrappers), Anthropic API (via `ANTHROPIC_BASE_URL`), and Atlassian/Jira/Confluence (via the `/api/v1/jira/*` and `/api/v1/confluence/*` REST endpoints) credentials. +The gateway sidecar injects credentials at the proxy layer, ensuring the sandbox container has zero credential access. This covers GitHub (via git wrappers), Anthropic API (via `ANTHROPIC_BASE_URL`), LiteLLM proxy (via `x-api-key` on sessions routed to the `litellm` upstream), and Atlassian/Jira/Confluence (via the `/api/v1/jira/*` and `/api/v1/confluence/*` REST endpoints) credentials. **Key properties:** - **Zero credential exposure**: Container never sees API keys, OAuth tokens, or GitHub tokens @@ -147,6 +147,7 @@ Gateway enforcement cannot be bypassed because: |------|--------|-----------------| | API Key | `ANTHROPIC_API_KEY` in secrets.env | `x-api-key: ` | | OAuth Token | `ANTHROPIC_OAUTH_TOKEN` in secrets.env | `Authorization: Bearer ` | +| LiteLLM Master Key | `LITELLM_MASTER_KEY` in secrets.env | `x-api-key: ` (LiteLLM upstream only) | | Atlassian / Jira | `ATLASSIAN_*` (preferred) or `JIRA_*` triple in secrets.env | `Authorization: Basic ` | | Atlassian / Confluence | `ATLASSIAN_*` (preferred) or `CONFLUENCE_*` triple in secrets.env | `Authorization: Basic ` | @@ -222,7 +223,8 @@ This precedence (ATLASSIAN-wins, CONFLUENCE as back-compat fallback) matches the | File | Purpose | |------|---------| | `gateway/gateway.py` | Anthropic proxy endpoints, `/api/v1/jira/*` and `/api/v1/confluence/*` routes, credential injection, tool filtering, `_reload_all_config()` hot-reload hook | -| `gateway/anthropic_credentials.py` | Anthropic credential loading from secrets.env | +| `gateway/upstream_registry.py` | Per-upstream registry of `(httpx.Client, credential_resolver)` pairs; lazily initialises the Anthropic and LiteLLM clients; validates `upstream` on session-create | +| `gateway/anthropic_credentials.py` | Anthropic credential loading from secrets.env; also provides `LiteLLMCredentialsManager` for the `LITELLM_MASTER_KEY` | | `gateway/jira_credentials.py` | Atlassian credential loading from secrets.env for Jira (mtime refresh, basic-auth header helper, `ATLASSIAN_*` precedence) | | `gateway/confluence_credentials.py` | Atlassian credential loading from secrets.env for Confluence (mtime refresh, `ATLASSIAN_*` precedence with `/wiki` derivation) | | `gateway/jira_client.py` | Jira REST client + `validate_jira_api_path` regex allowlist + 429 retry + 404 envelope | diff --git a/docs/architecture/kubernetes-migration.md b/docs/architecture/kubernetes-migration.md index 5819011bdb..70c449d718 100644 --- a/docs/architecture/kubernetes-migration.md +++ b/docs/architecture/kubernetes-migration.md @@ -42,7 +42,8 @@ Host Machine k3s Cluster ├── Namespace: egg-system │ ├── Deployment: orchestrator (+ Service :9849) -│ └── Deployment: gateway (+ Service :9848, :3129, :9851) +│ ├── Deployment: gateway (+ Service :9848, :3129, :9851) +│ └── Deployment: litellm (+ Service :4000) # non-Claude model proxy; no-op until model_list populated (#2769) │ ├── Namespace: egg-agents │ ├── Job: agent-coder-{pipeline-id} diff --git a/docs/deploy/resource-sizing.md b/docs/deploy/resource-sizing.md index 81294a182b..a1aec52339 100644 --- a/docs/deploy/resource-sizing.md +++ b/docs/deploy/resource-sizing.md @@ -1,6 +1,6 @@ # Pod resource sizing -Resource requests and limits for the three pod types in the egg stack, with the observed telemetry they were tuned against. See #1888 / #1895 for the right-sizing initiative. +Resource requests and limits for the four pod types in the egg stack. The `gateway`, `orchestrator`, and `egg-sandbox-*` allocations were tuned against the observed telemetry below; the `litellm` row was sized from `k8s/base/litellm-deployment.yaml` (it postdates the snapshots, so no telemetry exists for it yet). See #1888 / #1895 for the right-sizing initiative. ## Current allocations @@ -8,6 +8,7 @@ Resource requests and limits for the three pod types in the egg stack, with the |---|---|---|---|---|---| | `gateway` (egg-system) | 200m | 2 | 2Gi | 4Gi | Burstable | | `orchestrator` (egg-system) | 250m | 1 | 512Mi | 1Gi | Burstable | +| `litellm` (egg-system) | 100m | 1 | 256Mi | 1Gi | Burstable | | `egg-sandbox-*` (egg-agents, per-agent) | 250m | 2 | 512Mi | 2Gi | Burstable | Gateway/orchestrator values live in `k8s/base/gateway-deployment.yaml` and `k8s/base/orchestrator-deployment.yaml`. Sandbox defaults are applied programmatically in `orchestrator/kubernetes_client.py` (`create_container`); callers can override via `kwargs["resources"]`. @@ -41,7 +42,7 @@ The sandbox tester peaks at 566Mi mem / 189m CPU — well inside the 2Gi / 2-cor ## QoS rationale -All three pod types are **Burstable** (`request < limit`). On a single-node k3s cluster, the ratio of idle:spike is wide enough that Guaranteed QoS (`request == limit`) would force large reservations that sit idle most of the time. Burstable lets the scheduler pack more pods per node while still giving each a guaranteed floor. +All four pod types are **Burstable** (`request < limit`). On a single-node k3s cluster, the ratio of idle:spike is wide enough that Guaranteed QoS (`request == limit`) would force large reservations that sit idle most of the time. Burstable lets the scheduler pack more pods per node while still giving each a guaranteed floor. ## Changes in this round diff --git a/docs/guides/sdlc-pipeline.md b/docs/guides/sdlc-pipeline.md index 3941a4dd77..6a741a6de0 100644 --- a/docs/guides/sdlc-pipeline.md +++ b/docs/guides/sdlc-pipeline.md @@ -1317,6 +1317,7 @@ per-phase overrides unless that uniform behaviour is intended. | `spawn_retry_initial_backoff_seconds` | float | `2.0` | Initial backoff between spawn retries. Subsequent attempts scale by 2.5× (e.g. 2 s, 5 s, 12.5 s). | | `phase_spawn_max_retries` | int | `2` | Max phase-level retry attempts when one or more roles fail with a transient spawn error (e.g. gateway cold start). Total phase-level attempts = `phase_spawn_max_retries + 1`. Only failed roles are respawned; survivors continue running. Per-role retries (`spawn_max_retries`) run first; this outer budget covers longer outages (~30 s+). Set to `0` to disable. | | `phase_spawn_retry_initial_backoff_seconds` | float | `30.0` | Initial backoff before the first phase-level spawn retry. Subsequent attempts scale by 3× (e.g. 30 s, 90 s). | +| `agent_models` | dict[str, str] | `{}` | Per-role model overrides keyed by AgentRole value (e.g. `{"refiner": "qwen3-coder-30b"}`). A Claude alias (`opus`, `opus[1m]`, `sonnet`, `sonnet[1m]`, `haiku`, `claude-*`) routes through the Anthropic upstream; any other string routes through the in-cluster LiteLLM proxy. Keys must be SDLC phase producer/reviewer roles — utility roles (overseer, autofixer) are rejected at construction time. See [Per-Agent Models](per-agent-models.md) and [#2769](https://github.com/jwbron/egg/issues/2769). | All phases use concurrent BRC execution by default.