Skip to content

docs(ai-transport): add token streaming example, reframe append example#3448

Draft
rainbowFi wants to merge 1 commit into
mainfrom
AIT-1030-ai-transport-token-streaming-example
Draft

docs(ai-transport): add token streaming example, reframe append example#3448
rainbowFi wants to merge 1 commit into
mainfrom
AIT-1030-ai-transport-token-streaming-example

Conversation

@rainbowFi

Copy link
Copy Markdown
Contributor

What

Refreshes the out-of-date AI Transport streaming examples (AIT-1030).

  • New runnable example ai-transport-token-streaming (React). Uses the AI Transport SDK (v0.3.0), mirroring the Core SDK getting started: the agent flow (createAgentSessioncreateRunstartloadConversationpipeend) and the client hooks (ClientSessionProvider, useView, useClientSession). The model is mocked so it runs without an API key, but the fake LLM emits the exact UIMessageChunk stream that streamText(...).toUIMessageStream() produces, so the agent code is identical to a production integration. The two necessary deviations (agent runs in-browser instead of a server route; token source is mocked) are commented in the code.
  • ai-transport-message-per-responsepub-sub-message-append, reclassified under the Pub/Sub product. It already used raw pub/sub appendMessage + rewind rather than the SDK, so the code is unchanged; the READMEs and gallery copy now describe it honestly and point to the token streaming example as the recommended approach for AI.
  • Removed ai-transport-message-per-token.
  • Wired Sandpack + workspace dependencies (@ably/ai-transport ~0.3.0, ai ^6, bumped ably to ~2.23.0 for the SDK peer), bumped the AIT SDK version registry 0.2 → 0.3.

Cross-link audit

  • features/token-streaming.mdx and platform/pricing/examples/ai-chatbot.mdx meta descriptions updated to drop the retired "message-per-response / message-per-token pattern" names.
  • redirect_from slugs (/message-per-response, /message-per-token) kept so old URLs still redirect.
  • Feature-page text confirmed consistent with the new example (run.pipe + useView).

Notes / for reviewers

  • React-only for the new example: the SDK client is hook-centric and this tracks the React Core SDK getting started; a JS variant would diverge into the lower-level View API. Consistent with other single-language examples (chat UI, LiveObjects).
  • Types validated against the real @ably/ai-transport@0.3.0 + ai@6 + ably@2.23, and the import graph bundles. The live Sandpack preview was not run locally — add the review-app label and click through before merge.
  • Divergence from older Pub/Sub example conventions is intentional, per the AI Transport docs principles.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b2896682-31b8-4a2c-8554-cbf9fc6a2830

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch AIT-1030-ai-transport-token-streaming-example

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@rainbowFi rainbowFi added the review-app Create a Heroku review app label Jun 26, 2026
@rainbowFi rainbowFi force-pushed the AIT-1030-ai-transport-token-streaming-example branch from 3ecb933 to fd3ecc2 Compare June 26, 2026 13:14
Add a runnable AI Transport token streaming example that uses the AI
Transport SDK (v0.3.0), mirroring the Core SDK getting started: the agent
flow (createAgentSession, createRun, start, loadConversation, pipe, end)
and the client hooks (ClientSessionProvider, useView, useClientSession).
The model is mocked so it runs without a key, but emits the same
UIMessageChunk stream a production integration produces.

Move the former ai-transport-message-per-response example to
pub-sub-message-append under the Pub/Sub product, since it uses raw
pub/sub appendMessage rather than the SDK. Reframe its copy to point to
the token streaming example as the recommended approach for AI.

Remove the ai-transport-message-per-token example.

Wire up Sandpack and workspace dependencies (@ably/ai-transport, ai, bump
ably to 2.23 for the SDK peer) and bump the AI Transport SDK version
registry to 0.3. Update token-streaming and ai-chatbot pricing
meta descriptions that referenced the retired pattern names.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-app Create a Heroku review app

Development

Successfully merging this pull request may close these issues.

2 participants