Skip to content

feat(harness): pick up the Lyzr key every turn - #20

Merged
yash-kark merged 1 commit into
feat/p1-sdk-2-remove-events-sinkfrom
feat/p1-sdk-10-per-turn-key
Oct 28, 2026
Merged

yash-kark merged 1 commit into
feat/p1-sdk-2-remove-events-sinkfrom
feat/p1-sdk-10-per-turn-key

Conversation

@yash-kark

Copy link
Copy Markdown
Contributor

Stack: 10 of 10 (base #19). Plan: .claude/plans/p1-sdk-egress-routes.md phase 10 (C2; D21).

What changes

  • gateway_envs.key_envs(api_key) returns the three key variables. build_gateway_envs(*, llm_url) now holds only URLs and flags.
  • HarnessCoordinator takes api_key=Settings.api_key. At boot and at every run_chat:
    • envs = {**static, **key_envs(api_key())};
    • the turn's manifest copy gives the bound MCP servers headers["x-api-key"] = api_key(). A server counts as bound only when its URL matches the bound one, so the GAP gap_tools server and caller-supplied servers are untouched;
    • then the Claude CLI forwarder rewrite from phase 5.
  • Missing key: if LYZR_API_KEY is unset at a turn, the turn fails with SettingsError before the guardrails check or the engine runs, and the message carries no value.
  • Explicit key: an explicit api_key= is used every turn, or its newest reissued successor; changes to LYZR_API_KEY don't affect it.
  • Docs: guide §3 LYZR_API_KEY row and the §6 env block; CHANGELOG Changed.

Not in this stack

Phases 11–12 (the app server and AgentCore) wait on Q16–Q18.

Tests

  • ruff / ruff format --check: clean
  • mypy src: 18 errors (same baseline)
  • pytest -m "not integration": 613 passed
  • New tests/test_turn_key.py:
    • test_engine_env_follows_the_key
    • test_mcp_headers_follow_the_key
    • test_explicit_api_key_follows_its_reissue
    • test_missing_key_fails_the_turn
  • Added test_key_envs; the env-merge and coordinator-env tests are updated.

🤖 Generated with Claude Code

@vrajp-lyzr
vrajp-lyzr added this pull request to stack #24 October 27, 2026 12:33
@yash-kark yash-kark mentioned this pull request Oct 28, 2026
@yash-kark
yash-kark force-pushed the feat/p1-sdk-10-per-turn-key branch 6 times, most recently from 00e5fbf to 8e36572 Compare October 28, 2026 17:19
Base automatically changed from feat/p1-sdk-9-agent-doc-sections to feat/p1-sdk-2-remove-events-sink October 28, 2026 17:19
The engine's ANTHROPIC_API_KEY / OPENAI_API_KEY / LYZR_API_KEY and the bound
MCP servers' x-api-key are set from Settings.api_key() at every turn (and at
boot); servers the loader or caller supplied are untouched. A missing key
fails the turn before the engine starts. build_gateway_envs holds no key;
key_envs() returns the three variables.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@yash-kark
yash-kark force-pushed the feat/p1-sdk-10-per-turn-key branch from 8e36572 to fa415ad Compare October 28, 2026 17:19
@yash-kark
yash-kark merged commit 32b3ed8 into feat/p1-sdk-2-remove-events-sink Oct 28, 2026
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant