Skip to content

feat(harness): support once-time overrides on the streaming /run_sse path#627

Merged
yaozheng-fang merged 1 commit into
mainfrom
feat/harness-run-sse-overrides
Jun 18, 2026
Merged

feat(harness): support once-time overrides on the streaming /run_sse path#627
yaozheng-fang merged 1 commit into
mainfrom
feat/harness-run-sse-overrides

Conversation

@yaozheng-fang

Copy link
Copy Markdown
Collaborator

Summary

The harness app's /run_sse (the ADK streaming endpoint, mounted via the ADK api server) previously always ran the base agent, so streaming callers couldn't use the per-call overrides that /harness/invoke supports. This brings override support to the streaming path:

  • Add a HarnessRunAgentRequest(RunAgentRequest) model with an extra optional harness field (a HarnessOverrides).
  • Register a custom /run_sse and move it to the front of the router so it shadows ADK's default route (which the default is kept and delegated to).
  • In the handler:
    • with harness override → stream a spawned agent (spawn_harness_agent(base, override) — base cloned + override applied), self-creating the session if absent; tool/skill load failures are surfaced as an SSE error event;
    • without overridedelegate to ADK's original /run_sse unchanged (base path stays bit-for-bit stock behavior).

This gives the streaming endpoint the same override capability as /harness/invoke, while leaving the base path untouched.

Test

TestClient (exercises the lifespan):

  • base /run_sse (no override) → base agent (HELLO.)
  • override /run_sse (harness.system_prompt="…PINEAPPLE") → spawned agent (PINEAPPLE)

Deployed end-to-end (harness built from this branch) and verified through the gateway:

  • run_sse no-override → HELLO; run_sse + --system-promptPINEAPPLE
  • existing /harness/invoke (base + override) unaffected (MANGO / BANANA)

ruff clean. The AgentKit CLI side (agentkit invoke harness --protocol run_sse) sends the overrides as the harness field.

🤖 Generated with Claude Code

…path

Override ADK's /run_sse: when the request carries a 'harness' override (via a HarnessRunAgentRequest subclass adding a 'harness' field), stream a spawned agent (base cloned + override applied). With no override, delegate to ADK's original /run_sse handler unchanged, so the base path is identical to stock run_sse. The custom route is moved to the front of the router to shadow the default; the spawn path self-creates the session if absent.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@yaozheng-fang yaozheng-fang merged commit 975b2da into main Jun 18, 2026
16 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.

2 participants