Skip to content

feat(agent): token-streaming loop + create_character tool#36

Merged
Stanley-blik merged 1 commit into
mainfrom
feat/agent-streaming-create-character
Jun 30, 2026
Merged

feat(agent): token-streaming loop + create_character tool#36
Stanley-blik merged 1 commit into
mainfrom
feat/agent-streaming-create-character

Conversation

@Stanley-blik

Copy link
Copy Markdown
Contributor

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 to chat. Yields
    {"type":"content","text":...} per token delta, assembling any tool_calls
    from the deltas, then a final {"type":"final","message":{...}} with the
    complete assistant message.
  • Agent.run_stream now emits a richer event vocabulary:
    token (reply text delta) → tool_starttool_resultreply (terminal).
    Previously it did one blocking chat() per turn and only surfaced whole
    messages. A UI can now type the reply out live and show tool activity as it
    happens. Agent.run collects the stream; its return shape is unchanged.
  • The HTTP /agent/chat SSE endpoint forwards loop events as-is, so it picks up
    streaming with no change (it already handles error).

2. create_character tool

  • flow_native.create_character adds a reusable Character to 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 (tokentool_starttool_result
    reply), tool execution against the project, run() collection, and
    create_character create/duplicate/attach.
  • Full suite: 28 passed. ruff check src tests: clean.

- 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.
@Stanley-blik Stanley-blik self-assigned this Jun 30, 2026

@Stanley-blik Stanley-blik left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Stanley-blik Stanley-blik merged commit 774edea into main Jun 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant