Skip to content

feat(sdk): deprecate ACPAgentSettings.llm credentials — create_agent no longer reads llm.api_key/base_url - #3652

Merged
simonrosenberg merged 2 commits into
mainfrom
acp-deprecate-llm-creds
Jun 11, 2026
Merged

simonrosenberg merged 2 commits into
mainfrom
acp-deprecate-llm-creds

Conversation

@simonrosenberg

@simonrosenberg simonrosenberg commented Jun 11, 2026 •

Copy link
Copy Markdown
Member

HUMAN:

deprecate ACPAgentSettings.llm credentials — create_agent no longer reads llm.api_key/base_url

  • A human has tested these changes.

AGENT:

Why

Fixes #3632; part of OpenHands/OpenHands#15722.

ACPAgentSettings.llm is attribution-only — the ACP subprocess makes its own model calls — but create_agent() folded llm.api_key/llm.base_url into agent_context.secrets via resolve_provider_env(). When a user's LLM profile carries a proxy base_url (e.g. an eval proxy), it leaked into the ACP subprocess as OPENAI_BASE_URL/ANTHROPIC_BASE_URL and silently re-routed its API calls, surfacing only as an opaque -32603 Internal error (#3632).

Neither production client needs the fold:

So the fold only ever fired for direct-SDK callers — where it was a silent foot-gun rather than a feature.

Summary

  • create_agent() no longer reads llm.api_key/llm.base_url. If either is set, it emits a DeprecationWarning (feature ACPAgentSettings.llm, removed in 1.33.0) pointing at the conversation secrets channel (agent_context.secrets / StartConversationRequest.secrets → state.secret_registry, keyed by the provider's env var name) and ignores them.
  • resolve_provider_env() is deprecated (warns on call, still functional through the window) — scheduled for removal in 1.33.0 together with the llm field itself (1.28.0 + the 5-minor public-API runway; acp_env keeps its own compliant 1.24.0 → 1.29.0 schedule).
  • ACPAgentSettings.llm field description and class docstring mark the field DEPRECATED (removed in 1.33.0); acp_model is the model identity, attribution stays internal.
  • Stale fold references cleaned up in agent_context field description, resolve_acp_env() docstring, _start_acp_server comment, and test docstrings.
  • Tests: fold tests replaced with ignore+warn coverage; create_request lift test now supplies the provider credential as an agent_context secret keyed by ANTHROPIC_API_KEY (the canonical channel, unchanged behavior).

No schema change: the llm field stays (accepted, attribution-only) until the 1.33.0 removal train, so persisted payloads and the discriminated union are untouched.

How to Test

  1. uv run pytest tests/sdk/test_settings.py tests/sdk/agent/test_acp_agent.py tests/sdk/settings/ tests/agent_server/test_settings_router.py tests/sdk/test_apply_agent_settings_diff.py — all pass.
  2. ACPAgentSettings(acp_server="claude-code", llm=LLM(model="m", api_key=SecretStr("k"))).create_agent() → emits DeprecationWarning for ACPAgentSettings.llm credentials; agent.agent_context carries no injected ANTHROPIC_API_KEY.
  3. Same settings with the credential supplied via agent_context.secrets={"ANTHROPIC_API_KEY": ...} → reaches request.secrets via create_request exactly as before.

🤖 Generated with Claude Code


Agent Server images for this PR

• GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server

Variants & Base Images

Variant Architectures Base Image Docs / Tags
java amd64, arm64 eclipse-temurin:17-jdk Link
python amd64, arm64 nikolaik/python-nodejs:python3.13-nodejs22-slim Link
golang amd64, arm64 golang:1.21-bookworm Link

Pull (multi-arch manifest)

# Each variant is a multi-arch manifest supporting both amd64 and arm64
docker pull ghcr.io/openhands/agent-server:4ddce21-python

Run

docker run -it --rm \
  -p 8000:8000 \
  --name agent-server-4ddce21-python \
  ghcr.io/openhands/agent-server:4ddce21-python

All tags pushed for this build

ghcr.io/openhands/agent-server:4ddce21-golang-amd64
ghcr.io/openhands/agent-server:4ddce219e453a3fb75aa9e3200ee05d35aae229e-golang-amd64
ghcr.io/openhands/agent-server:acp-deprecate-llm-creds-golang-amd64
ghcr.io/openhands/agent-server:4ddce21-golang_tag_1.21-bookworm-amd64
ghcr.io/openhands/agent-server:4ddce21-golang-arm64
ghcr.io/openhands/agent-server:4ddce219e453a3fb75aa9e3200ee05d35aae229e-golang-arm64
ghcr.io/openhands/agent-server:acp-deprecate-llm-creds-golang-arm64
ghcr.io/openhands/agent-server:4ddce21-golang_tag_1.21-bookworm-arm64
ghcr.io/openhands/agent-server:4ddce21-java-amd64
ghcr.io/openhands/agent-server:4ddce219e453a3fb75aa9e3200ee05d35aae229e-java-amd64
ghcr.io/openhands/agent-server:acp-deprecate-llm-creds-java-amd64
ghcr.io/openhands/agent-server:4ddce21-eclipse-temurin_tag_17-jdk-amd64
ghcr.io/openhands/agent-server:4ddce21-java-arm64
ghcr.io/openhands/agent-server:4ddce219e453a3fb75aa9e3200ee05d35aae229e-java-arm64
ghcr.io/openhands/agent-server:acp-deprecate-llm-creds-java-arm64
ghcr.io/openhands/agent-server:4ddce21-eclipse-temurin_tag_17-jdk-arm64
ghcr.io/openhands/agent-server:4ddce21-python-amd64
ghcr.io/openhands/agent-server:4ddce219e453a3fb75aa9e3200ee05d35aae229e-python-amd64
ghcr.io/openhands/agent-server:acp-deprecate-llm-creds-python-amd64
ghcr.io/openhands/agent-server:4ddce21-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-slim-amd64
ghcr.io/openhands/agent-server:4ddce21-python-arm64
ghcr.io/openhands/agent-server:4ddce219e453a3fb75aa9e3200ee05d35aae229e-python-arm64
ghcr.io/openhands/agent-server:acp-deprecate-llm-creds-python-arm64
ghcr.io/openhands/agent-server:4ddce21-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-slim-arm64
ghcr.io/openhands/agent-server:4ddce21-golang
ghcr.io/openhands/agent-server:4ddce219e453a3fb75aa9e3200ee05d35aae229e-golang
ghcr.io/openhands/agent-server:acp-deprecate-llm-creds-golang
ghcr.io/openhands/agent-server:4ddce21-golang_tag_1.21-bookworm
ghcr.io/openhands/agent-server:4ddce21-java
ghcr.io/openhands/agent-server:4ddce219e453a3fb75aa9e3200ee05d35aae229e-java
ghcr.io/openhands/agent-server:acp-deprecate-llm-creds-java
ghcr.io/openhands/agent-server:4ddce21-eclipse-temurin_tag_17-jdk
ghcr.io/openhands/agent-server:4ddce21-python
ghcr.io/openhands/agent-server:4ddce219e453a3fb75aa9e3200ee05d35aae229e-python
ghcr.io/openhands/agent-server:acp-deprecate-llm-creds-python
ghcr.io/openhands/agent-server:4ddce21-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-slim

About Multi-Architecture Support

  • Each variant tag (e.g., 4ddce21-python) is a multi-arch manifest supporting both amd64 and arm64
  • Docker automatically pulls the correct architecture for your platform
  • Individual architecture tags (e.g., 4ddce21-python-amd64) are also available if needed

…o longer reads llm.api_key/base_url

ACPAgentSettings.llm is attribution-only (the ACP subprocess makes its own
model calls), but create_agent() folded llm.api_key/llm.base_url into
agent_context.secrets via resolve_provider_env(). A proxy base_url from an
LLM profile would silently re-route the subprocess's API calls (#3632).

Both production clients already route provider credentials via
request.secrets keyed by the provider env var name (canvas never sends llm;
OpenHands strips the credentials before create_agent), so the fold only
fired for direct-SDK callers. create_agent() now warns and ignores llm
credentials; resolve_provider_env() warns on call. Both are scheduled for
removal in 1.29.0 together with acp_env.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

Python API breakage checks — ✅ PASSED

Result: ✅ PASSED

Action log

@github-actions

github-actions Bot commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

REST API breakage checks (OpenAPI) — ✅ PASSED

Result: ✅ PASSED

Action log

@simonrosenberg simonrosenberg self-assigned this Jun 11, 2026
@simonrosenberg simonrosenberg added the acp About ACP label Jun 11, 2026
@github-actions

github-actions Bot commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

Coverage

Coverage Report •
FileStmtsMissCoverMissing
openhands-sdk/openhands/sdk/agent
   acp_agent.py114610191%760–762, 999–1000, 1043, 1045, 1049, 1053, 1079, 1142–1143, 1148, 1215, 1529, 1532–1533, 1550–1551, 1587, 1592, 1670, 1675, 2009–2010, 2294–2297, 2301–2303, 2306–2310, 2312, 2530, 2544–2545, 2548–2550, 2558, 2562, 2566–2567, 2573–2574, 2586–2587, 2590, 2624, 2628–2630, 2634–2635, 2667, 2751, 2938–2940, 2943–2944, 2984, 3126, 3130, 3138–3140, 3178–3179, 3182, 3190–3192, 3194, 3196, 3200, 3203, 3212–3214, 3216, 3252–3253, 3271–3274, 3277, 3281–3283, 3285, 3289–3290, 3498–3499
openhands-sdk/openhands/sdk/settings
   model.py6934693%98, 397, 415, 595, 605–608, 611, 624, 628, 634, 644, 650, 655, 868, 893, 895, 897, 899, 901, 903, 905, 1167, 1169, 1583, 1603, 1766, 1895, 1934, 1960, 2096–2098, 2100, 2154, 2186, 2196, 2198, 2203, 2221, 2234, 2236, 2238, 2240, 2247
TOTAL31078636079% 

@all-hands-bot all-hands-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ QA Report: PASS

Verified the SDK behavior directly: deprecated ACPAgentSettings.llm credentials are ignored by create_agent(), a deprecation warning is emitted, and the explicit conversation-secrets path still carries provider credentials.

Does this PR achieve its stated goal?

Yes. The PR set out to stop create_agent() from reading llm.api_key / llm.base_url for ACP agents while warning direct SDK callers and preserving the canonical secrets channel. In the before/after SDK runs, origin/main injected OPENAI_API_KEY and OPENAI_BASE_URL into agent_context.secrets with no warning, while the PR emitted the deprecation warning and left only the caller-provided GITHUB_TOKEN; a separate ConversationSettings.create_request(StartConversationRequest) run confirmed explicit ANTHROPIC_API_KEY / GITHUB_TOKEN secrets still reach request.secrets.

Phase Result
Environment Setup ✅ make build completed successfully with uv-managed dependencies installed.
CI Status ⏳ GitHub checks snapshot: 25 pass, 7 pending, 14 skipped; no failing checks observed.
Functional Verification ✅ Public SDK calls exercised the changed behavior and compatibility path.
Functional Verification

Test 1: create_agent() no longer folds llm credentials into ACP secrets

Step 1 — Reproduce / establish baseline without the fix:
Checked out origin/main and ran a direct SDK script constructing ACPAgentSettings(acp_server="codex", llm=LLM(api_key=..., base_url=...), agent_context=...), then called settings.create_agent().

Relevant output:

branch_behavior=baseline_main
warning_count= 0
warning_messages= []
acp_env= {'MY_VAR': 'v'}
agent_context_present= True
secret_keys= ['GITHUB_TOKEN', 'OPENAI_API_KEY', 'OPENAI_BASE_URL']
secret_value[GITHUB_TOKEN]=ghp_context
secret_value[OPENAI_API_KEY]=sk-openai-baseline
secret_value[OPENAI_BASE_URL]=https://llm-proxy.example.com

This confirms the old behavior: direct SDK callers had llm.api_key and llm.base_url folded into ACP agent context secrets, which is the leak/re-routing foot-gun described by the PR.

Step 2 — Apply the PR's changes:
Checked out commit 072a52bb1b829f64f63696e6137f71343aadc0be.

Step 3 — Re-run with the fix in place:
Ran the equivalent direct SDK script against the PR commit.

Relevant output:

branch_behavior=pr_head
warning_count= 1
warning_messages= ["ACPAgentSettings.llm credentials (api_key/base_url) is deprecated as of 1.28.0 and will be removed in 1.29.0. create_agent() ignores them. Supply ACP provider credentials as conversation secrets (agent_context.secrets / StartConversationRequest.secrets, which route through state.secret_registry) keyed by the provider's env var name (e.g. ANTHROPIC_API_KEY)."]
acp_env= {'MY_VAR': 'v'}
agent_context_present= True
secret_keys= ['GITHUB_TOKEN']
secret_value[GITHUB_TOKEN]=ghp_context

This shows the fix works: the deprecated credentials are not injected as OPENAI_API_KEY / OPENAI_BASE_URL, caller-provided context secrets remain intact, and direct SDK callers get an explicit deprecation warning.

Test 2: ignored credentials do not synthesize a new AgentContext

Step 1 — Baseline behavior being changed:
The pre-PR behavior synthesized an AgentContext when only llm.api_key was supplied, because it needed somewhere to store folded provider credentials.

Step 2 — Apply the PR's changes:
Used the PR commit and constructed ACPAgentSettings(acp_server="claude-code", llm=LLM(api_key=...)) with no caller context.

Step 3 — Run with the fix in place:
Relevant output:

scenario=no_context_llm_credentials
warning_count= 1
warning_contains_llm_credentials= True
agent_context_is_none= True
acp_env= {}

This confirms deprecated credentials are ignored rather than creating a synthetic context, with the warning as the caller-visible migration signal.

Test 3: canonical conversation secrets path still works

Step 1 — Baseline behavior that must remain available:
The PR description says provider credentials should ride agent_context.secrets / StartConversationRequest.secrets, keyed by provider env var, instead of llm credentials.

Step 2 — Apply the PR's changes:
On the PR commit, constructed ConversationSettings with an ACP agent whose agent_context.secrets included ANTHROPIC_API_KEY and GITHUB_TOKEN, then called create_request(StartConversationRequest) using a real LocalWorkspace.

Step 3 — Run with the fix in place:
Relevant output:

scenario=create_request_explicit_context_secrets
workspace_kind= LocalWorkspace
request_secret_keys= ['ANTHROPIC_API_KEY', 'GITHUB_TOKEN']
request_secret_value[ANTHROPIC_API_KEY]=sk-direct
request_secret_value[GITHUB_TOKEN]=ghp_direct

This confirms the replacement channel still carries explicit provider credentials into the start request as intended.

Test 4: deprecated resolve_provider_env() remains functional during the window

Step 1 — Baseline compatibility requirement:
The PR claims resolve_provider_env() remains functional but now warns callers during the deprecation window.

Step 2 — Apply the PR's changes:
On the PR commit, constructed Gemini ACP settings with llm.api_key and llm.base_url, then called resolve_provider_env().

Step 3 — Run with the fix in place:
Relevant output:

scenario=deprecated_resolve_provider_env
env= {'GEMINI_API_KEY': 'sk-test-gemini', 'GEMINI_BASE_URL': 'https://gemini-proxy.example.com'}
warning_count= 1
warning_contains_resolve_provider_env= True

This confirms the helper still returns the expected provider env mapping while emitting the promised deprecation warning.

Issues Found

None.

This review was created by an AI agent (OpenHands) on behalf of the user.

Final verdict: PASS

@enyst

enyst commented Jun 11, 2026

Copy link
Copy Markdown
Member

@OpenHands find the deprecation policy for python public api, the one with 5 minor releases. This pr used deprecation inconsistently? Verify. Why are the griffe and oasdiff workflows not falling? Wdyt should they fail in this case? explain.

Respond as a comment on github here.

@openhands-ai

openhands-ai Bot commented Jun 11, 2026

Copy link
Copy Markdown

I'm on it! enyst can track my progress at all-hands.dev

@simonrosenberg

Copy link
Copy Markdown
Member Author

@enyst it's true that I fast-tracked the deprecation... But I really want this out before acp cloud release, this way secrets will be handled cleanly by everyone when it's out...

enyst commented Jun 11, 2026

Copy link
Copy Markdown
Member

@enyst I checked the SDK policy and this PR’s markers.

Policy I found

  • openhands-sdk/openhands/sdk/AGENTS.md says symbols exported via openhands.sdk.__all__ are the public SDK surface, and public API removals need canonical deprecation metadata with removed_in at least 5 minor releases after deprecated_in.
  • ACPAgentSettings is exported from openhands.sdk.__all__, so public members on it (including llm and resolve_provider_env) fall under that policy if we plan to remove them.
  • Current SDK version on this branch is 1.28.0, so a policy-compliant new public API deprecation starting in 1.28.0 would have a minimum removal target of 1.33.0, not 1.29.0.

Consistency check

I agree the PR is inconsistent if read as a public API removal plan:

  • ACPAgentSettings.acp_env is consistent with the policy: it is marked deprecated_in="1.24.0", removed_in="1.29.0" — that is the 5-minor runway.
  • ACPAgentSettings.resolve_provider_env is newly marked deprecated_in="1.28.0", removed_in="1.29.0". That is only one minor release, so it does not satisfy the public API removal policy.
  • ACPAgentSettings.llm is described in the class docstring / field description as “removed in 1.29.0”, but the field itself is not marked with a canonical public-API deprecation marker. The runtime warning is for ACPAgentSettings.llm credentials (api_key/base_url), not for the public ACPAgentSettings.llm member as a whole. So if the intent is to remove the llm field, the PR both lacks the canonical marker for that field and gives an invalid 1.28 → 1.29 removal window.

The behavioral change itself — create_agent() no longer folding llm.api_key / llm.base_url into ACP subprocess secrets — is not a structural public API removal. It’s a behavior change/bug fix for the credential leak foot-gun. But the PR text/docstrings go further and say the public llm field and resolve_provider_env() are removed in 1.29.0, which conflicts with the policy unless we explicitly accept a policy exception.

Why the workflows pass

  • The Griffe-based “Python API breakage” workflow compares public API shape. In this PR, no exported symbol/member was removed, no signature changed, and Field(...) description/doc metadata changes are intentionally treated as non-breaking. Griffe also does not inspect method bodies, so the create_agent() behavior change and the new warning do not show up as API breakage. The 5-minor runway check is applied when a removal happens, using the previous release’s deprecation metadata; if we tried to remove these public members in 1.29.0, that removal should fail because the baseline metadata would say 1.28 → 1.29 instead of at least 1.33.
  • The deprecation-check workflow scans deprecation metadata for deadlines that have already been reached. Since this branch is version 1.28.0, removed_in="1.29.0" is not overdue yet. That check does not currently validate “new public API deprecation must have >=5 minor runway” at introduction time.
  • The oasdiff workflow is for the agent-server REST/OpenAPI contract (/api/**). This PR does not remove or incompatibly change a REST route/schema property, so I would not expect oasdiff to fail.

My take

I don’t think oasdiff should fail here. I also don’t think the Griffe breakage check, as currently scoped, should fail on the credential-fold behavior change because the Python API shape is unchanged.

But I do think we should avoid leaving a public API deprecation schedule that CI will reject later. Either:

  1. change the public API removal targets for ACPAgentSettings.llm / resolve_provider_env() to at least 1.33.0; or
  2. narrow this PR to deprecating/ignoring only the llm.api_key / llm.base_url credential transport behavior, and remove the “field/method removed in 1.29.0” claims unless maintainers explicitly want a policy exception.

If we want this caught before the future removal PR, the best workflow improvement would be in check_deprecations.py (or a companion SDK deprecation lint): when a canonical deprecation targets a public SDK export/member, fail immediately if removed_in < deprecated_in + 5 minor releases.

This comment was created by an AI agent (OpenHands) in response to the requested PR review comment.

@OpenHands OpenHands deleted a comment from openhands-ai Bot Jun 11, 2026
…qualified member marker

Public-API removals require removed_in >= deprecated_in + 5 minor releases
(openhands-sdk AGENTS.md, enforced by check_sdk_api_breakage.py at release
time by qualified feature name). Move resolve_provider_env and the llm
field to removed_in=1.33.0 and rename the create_agent warning feature to
'ACPAgentSettings.llm' so the marker matches the member at removal time.
acp_env stays on its compliant 1.24.0->1.29.0 schedule.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@simonrosenberg
simonrosenberg force-pushed the acp-deprecate-llm-creds branch from 902436a to 4ddce21 Compare June 11, 2026 13:27
@simonrosenberg

Copy link
Copy Markdown
Member Author

@enyst Good catch — the schedule was non-compliant, fixed in 4ddce21.

I verified the analysis against the policy (openhands-sdk/AGENTS.md) and check_sdk_api_breakage.py: the runway check runs on release PRs and matches removed public members against the baseline release's deprecation metadata by qualified feature name, requiring removed_in >= deprecated_in + 5 minors. As written, this PR would have planted two failures for the future removal PR: a 1-minor window on resolve_provider_env, and a marker name ("ACPAgentSettings.llm credentials (api_key/base_url)") that would never match the ACPAgentSettings.llm member.

Changes:

  • removed_in="1.29.0" → "1.33.0" on both markers (1.28.0 + 5 minors), prose updated to match.
  • The create_agent warning feature renamed to the qualified member name "ACPAgentSettings.llm" so the marker counts when the field is removed.
  • acp_env untouched — its 1.24.0 → 1.29.0 schedule is exactly the 5-minor runway.

No policy exception needed: the thing the ACP cloud release depends on is the behavior (credentials no longer read from llm, secrets ride the registry channel), which ships in the next release regardless. Only the dead-code deletion of the field/method moves to 1.33.0.

Agreed on the workflow gap: check_deprecations.py runs on every PR but only enforces deadlines already reached, so an under-5-minor schedule on a public member sails through at introduction time (as this PR demonstrated). An introduction-time runway lint there would have caught this; happy to send a follow-up PR for it.

@enyst enyst left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I rechecked the updated deprecation schedule: ACPAgentSettings.resolve_provider_env and the ACPAgentSettings.llm marker now use 1.28.0 → 1.33.0, matching the 5-minor public SDK API runway, while the behavioral fix remains scoped to ignoring deprecated llm credentials and routing credentials through the secrets channel. CI is green.

This review was submitted by an AI agent (OpenHands) on behalf of the user.

@simonrosenberg
simonrosenberg merged commit d846b67 into main Jun 11, 2026
41 checks passed
@simonrosenberg
simonrosenberg deleted the acp-deprecate-llm-creds branch June 11, 2026 13:43

@all-hands-bot all-hands-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ QA Report: PASS

Verified the ACP SDK settings behavior with real SDK calls: PR head stops llm credential propagation while preserving the conversation-secret path.

Does this PR achieve its stated goal?

Yes. On origin/main, constructing an ACP agent with llm.api_key and llm.base_url injected ANTHROPIC_API_KEY and ANTHROPIC_BASE_URL into both agent_context and StartConversationRequest.secrets with no warning. On PR head 4ddce219, the same SDK usage produced no injected secrets and emitted a deprecation warning compatible with DeprecationWarning; supplying credentials through agent_context.secrets still reached StartConversationRequest.secrets unchanged.

Phase Result
Environment Setup ✅ make build completed successfully; no tests, linters, or pre-commit hooks were run manually.
CI Status ✅ GitHub reports 34 successful checks, 2 skipped, 0 failing, 0 pending.
Functional Verification ✅ Direct SDK usage confirms the old leak is gone and the supported secrets channel still works.
Functional Verification

Test 1: llm.api_key / llm.base_url no longer propagate into ACP agent/request secrets

Step 1 — Reproduce / establish baseline without the fix:

Ran git checkout --detach origin/main && OPENHANDS_SUPPRESS_BANNER=1 uv run python /tmp/acp_qa.py, where the script constructed ACPAgentSettings(acp_server="claude-code", llm=LLM(... api_key=..., base_url=...)), called create_agent(), ConversationSettings.create_request(StartConversationRequest), and resolve_provider_env():

{
  "create_agent_with_llm_credentials": {
    "context_is_none": false,
    "secret_keys": [
      "ANTHROPIC_API_KEY",
      "ANTHROPIC_BASE_URL"
    ],
    "warnings": []
  },
  "create_request_with_llm_credentials": {
    "request_secret_keys": [
      "ANTHROPIC_API_KEY",
      "ANTHROPIC_BASE_URL"
    ],
    "warnings": []
  },
  "resolve_provider_env": {
    "env_keys": [
      "ANTHROPIC_API_KEY",
      "ANTHROPIC_BASE_URL"
    ],
    "warnings": []
  }
}

This confirms the baseline bug: an LLM profile base URL/API key is silently folded into the ACP secrets path.

Step 2 — Apply the PR's changes:

Checked out acp-deprecate-llm-creds at 4ddce219e453a3fb75aa9e3200ee05d35aae229e.

Step 3 — Re-run with the fix in place:

Ran OPENHANDS_SUPPRESS_BANNER=1 uv run python /tmp/acp_qa.py on the PR branch:

{
  "create_agent_with_llm_credentials": {
    "context_is_none": true,
    "secret_keys": [],
    "warnings": [
      "DeprecatedWarning: ACPAgentSettings.llm is deprecated as of 1.28.0 and will be removed in 1.33.0. create_agent() ignores its api_key/base_url. Supply ACP provider credentials as conversation secrets (agent_context.secrets / StartConversationRequest.secrets, which route through state.secret_registry) keyed by the provider's env var name (e.g. ANTHROPIC_API_KEY); use acp_model for model identity."
    ]
  },
  "create_request_with_llm_credentials": {
    "request_secret_keys": [],
    "warnings": [
      "DeprecatedWarning: ACPAgentSettings.llm is deprecated as of 1.28.0 and will be removed in 1.33.0. create_agent() ignores its api_key/base_url. Supply ACP provider credentials as conversation secrets (agent_context.secrets / StartConversationRequest.secrets, which route through state.secret_registry) keyed by the provider's env var name (e.g. ANTHROPIC_API_KEY); use acp_model for model identity."
    ]
  },
  "resolve_provider_env": {
    "env_keys": [
      "ANTHROPIC_API_KEY",
      "ANTHROPIC_BASE_URL"
    ],
    "warnings": [
      "DeprecatedWarning: ACPAgentSettings.resolve_provider_env is deprecated as of 1.28.0 and will be removed in 1.33.0. Supply ACP provider credentials as conversation secrets (agent_context.secrets / StartConversationRequest.secrets, which route through state.secret_registry) keyed by the provider's env var name instead of ACPAgentSettings.llm."
    ]
  }
}

This confirms the PR behavior: create_agent()/create_request() ignore llm credentials and warn, while resolve_provider_env() remains functional during the deprecation window and warns.

Test 2: Supported agent_context.secrets channel still works

Using the same script, I supplied fake provider credentials through AgentContext(secrets={"ANTHROPIC_API_KEY": ..., "GITHUB_TOKEN": ...}) and created a StartConversationRequest.

Baseline and PR both produced:

{
  "create_agent_with_context_secret": {
    "context_is_none": false,
    "secret_keys": [
      "ANTHROPIC_API_KEY",
      "GITHUB_TOKEN"
    ]
  },
  "create_request_with_context_secret": {
    "request_secret_keys": [
      "ANTHROPIC_API_KEY",
      "GITHUB_TOKEN"
    ]
  }
}

This confirms the intended replacement path still works for a real SDK caller: named secrets supplied through agent_context.secrets are lifted into StartConversationRequest.secrets.

Issues Found

None.

Final verdict: PASS.

This QA review was created by an AI agent (OpenHands) on behalf of the user.

pengzhang-create pushed a commit to Pyromind-Dynamics/software-agent-sdk that referenced this pull request Aug 13, 2026
…no longer reads llm.api_key/base_url (OpenHands#3652)

Co-authored-by: Simon Rosenberg <simon@openhands.dev>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

acp About ACP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove llm field from ACPAgentSettings

3 participants