feat(invoke harness): add run_sse protocol alongside invoke#81
Open
yaozheng-fang wants to merge 7 commits into
Open
feat(invoke harness): add run_sse protocol alongside invoke#81yaozheng-fang wants to merge 7 commits into
yaozheng-fang wants to merge 7 commits into
Conversation
Add --protocol {invoke|run_sse} to 'agentkit invoke harness'. run_sse calls the deployed harness's ADK /run_sse endpoint: fixed app_name 'harness', a random CLI-generated user_id (temporary), and the caller's session_id; it creates the session then streams the answer (skipping model thought parts and the final aggregate). The existing /harness/invoke path is unchanged and remains the default.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The harness /run_sse now honors once-time overrides (spawned agent), so the CLI's run_sse mode sends --system-prompt/--model-name/--tools/--skills/--runtime as the 'harness' field. Only --max-llm-calls remains invoke-only. Base (no-override) run_sse is unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The run_sse path used a random u-<uuid> user_id. When the bearer token is an OIDC id_token (custom_jwt harness), decode its sub claim and use it as user_id so sessions tie to the authenticated identity; fall back to random for opaque key_auth tokens. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
e10fa9e to
ad9f7e8
Compare
run_sse is now the default transport for `agentkit invoke harness`; pass --protocol invoke for the /harness/invoke path. When --session-id is unset the run_sse path mints a random s-<id> (creating it is idempotent). Existing invoke-path tests pin --protocol invoke via a _run_invoke helper. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Update the invoke harness section: run_sse is now the default transport, run_sse user_id comes from the JWT sub (or random), --session-id is minted randomly when unset (idempotent create), and auth auto-loads the agentkit login id_token for custom_jwt harnesses (no -ak needed) for both transports. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… reasoning - invoke now mints a random s-<id> session when --session-id is unset, matching run_sse (session handling is identical across transports). - run_sse renders the model's reasoning (thought parts) dim/grey under a '🤔 思考中…' header so the wait isn't blank, then the answer under '📝 Response:'. - docs updated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Drop the 🤔/📝 emoji headers. The wait + reasoning phase now shows a 'thinking' loading spinner (model thought parts stay hidden); once the answer arrives the spinner stops and the reply streams after a blank line. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
Adds a second transport to
agentkit invoke harness:--protocol run_sse, which streams from the deployed harness over ADK's/run_sseendpoint (alongside the existing default--protocol invoke→POST /harness/invoke).Rebased onto
main(which now carries the #84 JWT data-plane auth), so the net change here is just the run_sse path.Changes
--protocol invoke|run_sse(defaultinvoke). Unknown value → fast-fail.run_ssepath (_harness_run_sse):app_namefixed to"harness"(CLI-side constant; decoupled from the deployedHARNESS_NAME).POST /run_sse, streamingpartialdeltas (skips the final aggregate andthoughtparts so the answer isn't double-printed).--system-prompt/--model-name/--tools/--skills/--runtime) are sent as theharnessfield so the runtime streams a spawned (overridden) agent; without them it streams the base agent.--max-llm-callsis invoke-only and ignored here (with a notice).user_idfrom JWTsub: when the bearer token is an OIDC id_token (custom_jwt harness), decode itssubclaim and use it as the run'suser_idso sessions tie to the authenticated identity; opaque key_auth tokens fall back to a randomu-<uuid>.--apikey> login id_token for custom_jwt > static key for key_auth, with 401 force-refresh retry) now applies to both transports — sorun_sseagainst a custom_jwt harness needs no explicit-ak.Tests
tests/toolkit/cli/test_cli_invoke_harness.py— run_sse streaming, override forwarding, invalid-protocol fast-fail, anduser_id-from-sub(plus the_user_id_from_tokenhelper). Full file: 22 passed;ruffclean.Verified end-to-end
Against a deployed custom_jwt harness with the local
agentkit loginid_token:--protocol run_ssewith an override → streamed the overridden answer,user_id= the token'ssub, no-akneeded.