feat(agent): token-streaming loop + create_character tool#36
Merged
Conversation
- NvidiaClient.chat_stream: stream content deltas and assemble tool_calls,
emitting {type:content} per token then {type:final} with the full message.
- Agent.run_stream now emits token/tool_start/tool_result/reply events so a UI
can type the reply out live and show tool activity as it happens (was a single
blocking chat() per turn). run() collects the stream unchanged in shape.
- flow_native: add create_character tool (adds a reusable Character to the cast;
rejects duplicates), completing cast/create parity with attach_character_to_scene.
- tests: streaming loop (tokens->tool_start->tool_result->reply) + create_character.
- README: 41->42 tools, document live token/tool streaming.
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
Two capability deltas that bring the OSS agent to parity with what the managed
studio has been running, so the package can power the hosted engine layer
directly (open-core: capability lives here, hosted consumes it).
1. Token-streaming agent loop
NvidiaClient.chat_stream— a streaming counterpart tochat. Yields{"type":"content","text":...}per token delta, assembling anytool_callsfrom the deltas, then a final
{"type":"final","message":{...}}with thecomplete assistant message.
Agent.run_streamnow emits a richer event vocabulary:token(reply text delta) →tool_start→tool_result→reply(terminal).Previously it did one blocking
chat()per turn and only surfaced wholemessages. A UI can now type the reply out live and show tool activity as it
happens.
Agent.runcollects the stream; its return shape is unchanged./agent/chatSSE endpoint forwards loop events as-is, so it picks upstreaming with no change (it already handles
error).2.
create_charactertoolflow_native.create_characteradds a reusableCharacterto the project cast(rejects duplicates), completing cast/create parity with the existing
attach_character_to_scene. Tool count 41 → 42.Tests
tests/test_agent.py: streaming order (token→tool_start→tool_result→reply), tool execution against the project,run()collection, andcreate_charactercreate/duplicate/attach.ruff check src tests: clean.