feat(cli): add agentkit list sessions --harness <name>#86
Open
yaozheng-fang wants to merge 1 commit into
Open
Conversation
List a user's conversation sessions on a deployed harness runtime via the
runtime's ADK data-plane endpoint GET /apps/harness/users/{user_id}/sessions.
ADK requires a user_id (no cross-user listing), so user_id is resolved as:
explicit --user-id > the JWT `sub` of the harness credential (custom_jwt uses
the `agentkit login` id_token or -ak) > fast-fail (e.g. a key_auth harness whose
opaque key is not a JWT). Harness addressing mirrors `invoke harness` (resolved
from the harness.json registry, harness credential for auth) — a data-plane call,
distinct from the control-plane `list harness` (AK/SK ListRuntimes).
Output: table (SessionId / Events / LastUpdate) plus json/yaml/--quiet.
A local `_user_id_from_token` mirrors the one in cli_invoke (not yet on main);
consolidate into one shared helper once the invoke run_sse work lands.
Docs: new "list sessions" section in docs harness page. Tests cover user_id
resolution (explicit, JWT sub, key_auth fast-fail), unknown harness, and output.
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
agentkit list sessions --harness <name>— lists a user's conversation sessions on a deployed harness runtime, by calling the runtime's ADK data-plane endpoint:user_id resolution
ADK's list endpoint takes
user_idas a required path param (no cross-user listing), so user_id must be determinable:--user-id <id>;subof the harness credential — a custom_jwt harness uses theagentkit loginid_token (or-ak), whosesubis the user;--user-id.Harness addressing mirrors
invoke harness(resolved from theharness.jsonregistry, harness credential for auth) — a data-plane call, distinct from the control-planelist harness(AK/SKListRuntimes).Changes
agentkit/toolkit/cli/cli_list.py—sessionscommand +_resolve_harness_endpoint+ a local_user_id_from_token. Output: table (SessionId/Events/LastUpdate) plusjson/yaml/--quiet.docs/content/2.agentkit-cli/5.harness.md— new "list sessions" section.tests/toolkit/cli/test_cli_list_sessions.py— 6 tests: explicit user_id, JWT-sub derivation, key_auth fast-fail (asserts no network call), unknown harness, quiet, json.Note (follow-up)
_user_id_from_tokenis duplicated locally here because the equivalent helper incli_invoke(from the in-flightinvoke harnessrun_sse work) is not yet on main — keeping this PR self-contained and independently mergeable. Once that work lands, both should consolidate into one shared helper.Testing
Also verified end-to-end against a live key_auth harness (explicit
--user-id).🤖 Generated with Claude Code