streaming

streaming is an agent for coding agents from cubeplexai/cubepi. It costs 17 tokens per session (1,554 once invoked), scanned A, original, MIT.

A real-time event stream for CubePi agents that reports model output, messages, tool calls, progress, completion, and errors.

In plain words
What is it for?
Use it to build live chat output, progress indicators, tool-call monitoring, and handlers for agent lifecycle events.
Why use it?
It lets an application show or process an agent's work while it is happening instead of waiting for the final response.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/cubeplexai/cubepi/streaming
Clone the repo
git clone --depth 1 https://github.com/cubeplexai/cubepi

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for streaming

README.md
[![agentmods](https://agentmods.dev/badge/agents/cubeplexai/cubepi/streaming.svg)](https://agentmods.dev/agents/cubeplexai/cubepi/streaming)
Your own site
<a href="https://agentmods.dev/agents/cubeplexai/cubepi/streaming"><img src="https://agentmods.dev/badge/agents/cubeplexai/cubepi/streaming.svg" alt="Measured on agentmods" height="20"></a>
Per session 17 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,554 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00017 $0.01554
Opus 5 $0.00009 $0.00777
Sonnet 5 $0.00003 $0.00311
Haiku 4.5 $0.00002 $0.00155

Measured 4d ago against content hash 8e4d60fa6a70, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

streaming scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

website/docs/guides/agents/streaming.md · 172 lines

How it starts

The opening of the file, as written. The whole thing — 172 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Streaming Events

CubePi exposes two streams, layered:

  1. Provider streamMessageStream you get from provider.stream(...). Yields StreamEvents describing the raw wire output: text deltas, thinking deltas, tool-call deltas, then done or error.
  2. Agent event stream — what listeners registered with agent.subscribe(...) see. Eleven event types covering the full lifecycle of a prompt() call, including provider events wrapped inside MessageUpdateEvent.

Most app code only needs the agent event stream.

The eleven agent events

Event Fires when
agent_start At the very beginning of prompt() / resume()
turn_start Before each model invocation (one or more per prompt)
message_start Right before a new message (user / assistant / tool result) is added to history
message_update On every provider StreamEvent (deltas, etc.); has event.stream_event attached
message_end After a message is finalised
tool_execution_start A tool call is dispatched (one per call, before parallel asyncio.gather)
tool_execution_update A tool reported partial progress via on_update(...)
tool_execution_end A tool finished (or failed)
turn_end After all tools in a batch settled, or after a tool-less assistant response
agent_end The whole prompt() call has finished — clean exit, abort, or error

MessageStartEvent and MessageEndEvent apply to every message, not just assistant ones. User and tool-result messages also get them.

Event order for a tool-using turn

A typical "user asks question → model calls one tool → model responds" sequence:

agent_start
turn_start
  message_start         (UserMessage from prompt)
  message_end           (UserMessage)
  message_start         (AssistantMessage — empty partial)
  message_update × N    (text_delta, toolcall_delta, …)
  message_end           (AssistantMessage — finalised)
  tool_execution_start
  tool_execution_end
  message_start         (ToolResultMessage)
  message_end           (ToolResultMessage)
turn_end
turn_start              (loop continues with the tool result in context)
  message_start
  message_update × N
  message_end
turn_end
agent_end

Read the full file on GitHub · 172 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 172 lines · 17 tokens per session scan A 8e4d60fa6a70

Subscribe to this mod's changes

streaming is an agent published in the GitHub repository cubeplexai/cubepi (43 stars, last pushed 2d ago), licensed MIT. It adds 17 tokens to every session and 1,554 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.