Skip to content

fix: display session ID after CLI invoke completes#957

Merged
jesseturner21 merged 2 commits intoaws:mainfrom
notgitika:fix/664-show-session-id-stream
Apr 24, 2026
Merged

fix: display session ID after CLI invoke completes#957
jesseturner21 merged 2 commits intoaws:mainfrom
notgitika:fix/664-show-session-id-stream

Conversation

@notgitika
Copy link
Copy Markdown
Contributor

Summary

Closes #664

Changes

  • types.ts — Added sessionId to InvokeResult interface
  • action.ts — Capture sessionId from invokeAgentRuntimeStreaming() and invokeAgentRuntime() responses and include it in the returned result
  • command.tsx — Print session ID and resume command to stderr after streaming or non-streaming output completes

Example output

<agent response>

Session: abc123-def456-...
To resume: agentcore invoke --session-id abc123-def456-...
Log: agentcore/.cli/logs/invoke/...

Test plan

  • Run agentcore invoke "hello" --stream — session ID printed after stream
  • Run agentcore invoke "hello" — session ID printed after response
  • Run agentcore invoke "hello" --json — session ID included in JSON output
  • Verify session ID is not printed when invoke fails

The streaming and non-streaming invoke responses include a session ID
from the runtime, but the CLI paths discarded it. Now prints the
session ID and a resume command hint after invoke output.
@notgitika notgitika requested a review from a team April 24, 2026 19:12
@github-actions github-actions Bot added the size/xs PR size: XS label Apr 24, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.9.1.tgz

How to install

npm install https://github.com/aws/agentcore-cli/releases/download/pr-957-tarball/aws-agentcore-0.9.1.tgz

@github-actions github-actions Bot added the agentcore-harness-reviewing AgentCore Harness review in progress label Apr 24, 2026
@jesseturner21
Copy link
Copy Markdown
Contributor

The AGUI protocol branch in action.ts (around lines 326–378) also receives a sessionId from invokeAguiRuntime() (see aguiResult.sessionId, and how the TUI uses it in useInvokeFlow.ts:349-351), but that branch still returns without populating sessionId on the InvokeResult. As a result, users invoking AGUI agents via the CLI won't get the session ID printed, even though the PR description says CLI paths that discarded the session ID are now fixed.

Suggested fix: capture aguiResult.sessionId in the AGUI branch and include it in the returned InvokeResult, e.g.:

return {
  success: !hasError,
  agentName: agentSpec.name,
  targetName: selectedTargetName,
  response,
  sessionId: aguiResult.sessionId,
  logFilePath: logger.logFilePath,
};

(A2A intentionally returns sessionId: undefined today, so no change needed there.)

@github-actions github-actions Bot added agentcore-harness-reviewing AgentCore Harness review in progress and removed agentcore-harness-reviewing AgentCore Harness review in progress labels Apr 24, 2026
@jesseturner21
Copy link
Copy Markdown
Contributor

Reviewed the PR. The one serious issue I spotted — the AGUI branch in action.ts not propagating aguiResult.sessionId into the returned InvokeResult, which leaves CLI AGUI users without the session ID despite the PR description — has already been flagged by @jesseturner21. No additional blocking issues from me; LGTM once that's addressed.

@github-actions github-actions Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Apr 24, 2026
@jesseturner21
Copy link
Copy Markdown
Contributor

Reviewed — the only serious issue I found (the AGUI branch not propagating sessionId into the InvokeResult) has already been raised by @jesseturner21. Once that's addressed, this looks good to merge.

@github-actions github-actions Bot removed the size/xs PR size: XS label Apr 24, 2026
@github-actions github-actions Bot added the size/xs PR size: XS label Apr 24, 2026
@notgitika
Copy link
Copy Markdown
Contributor Author

Good catch @jesseturner21 I added it in my latest commit

@jesseturner21 jesseturner21 merged commit 51e4a8e into aws:main Apr 24, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/xs PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Session ID not returned after agentcore invoke --stream

2 participants