Add support for output-format stream-jsonflag for headless mode#10883
Merged
Add support for output-format stream-jsonflag for headless mode#10883
Conversation
|
Size Change: +8.72 kB (+0.05%) Total Size: 17.8 MB
ℹ️ View Unchanged
|
jerop
previously requested changes
Oct 10, 2025
Contributor
There was a problem hiding this comment.
Excited for this feature, thanks @anj-s!
I was expecting this new mode to be an option on the existing --output-format flag. Right now, we have --output-format which accepts text and json. This new mode would be --output-format=stream-json, keeping all output-related formats under a single, consistent flag.
.option('output-format', {
type: 'string',
description: 'The output format for the response.',
choices: ['text', 'json', 'stream-json'],
})Was there a specific reason for introducing a new, separate --stream-format=output-json flag instead of extending the existing one?
Overall, this looks great - I'm happy to approve once we clarify the configuration.
bdmorgan
approved these changes
Oct 15, 2025
thacio
added a commit
to thacio/auditaria
that referenced
this pull request
Oct 17, 2025
…g for headless mode (google-gemini#10883)
Millsondylan
pushed a commit
to Millsondylan/gemini-cli-1
that referenced
this pull request
Oct 19, 2025
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.
TLDR
Adds
--output-format stream-jsonflag for non-interactive mode, enabling real-time JSONL event streaming. This allows external tools and scripts to monitor AI agent progress in real-time instead of waiting for a single JSON response at the end.Dive Deeper
Key features:
init,message,tool_use,tool_result,error,result--output-format jsonunchangedEvent sequence example:
{"type":"init","timestamp":"...","session_id":"abc123","model":"gemini-2.0-flash-exp"} {"type":"message","role":"user","content":"List files","timestamp":"..."} {"type":"tool_use","tool_name":"Bash","tool_id":"bash-123","parameters":{"command":"ls"},"timestamp":"..."} {"type":"tool_result","tool_id":"bash-123","status":"success","output":"file1.txt\nfile2.txt","timestamp":"..."} {"type":"message","role":"assistant","content":"Here are the files...","delta":true,"timestamp":"..."} {"type":"result","status":"success","stats":{"total_tokens":100,"input_tokens":50,"output_tokens":50,"duration_ms":1200,"tool_calls":1},"timestamp":"..."}Documentation:
Added to README.md and docs/
Reviewer Test Plan
Testing Matrix
Linked issues / bugs
fixes #8203