feat(harness): support once-time overrides on the streaming /run_sse path#627
Merged
Conversation
…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>
zakahan
approved these changes
Jun 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/invokesupports. This brings override support to the streaming path:HarnessRunAgentRequest(RunAgentRequest)model with an extra optionalharnessfield (aHarnessOverrides)./run_sseand move it to the front of the router so it shadows ADK's default route (which the default is kept and delegated to).harnessoverride → 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 SSEerrorevent;/run_sseunchanged (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):
/run_sse(no override) → base agent (HELLO.)/run_sse(harness.system_prompt="…PINEAPPLE") → spawned agent (PINEAPPLE)Deployed end-to-end (harness built from this branch) and verified through the gateway:
run_sseno-override →HELLO;run_sse+--system-prompt→PINEAPPLE/harness/invoke(base + override) unaffected (MANGO/BANANA)ruff clean. The AgentKit CLI side (
agentkit invoke harness --protocol run_sse) sends the overrides as theharnessfield.🤖 Generated with Claude Code