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.
npx agentmods add agents/cubeplexai/cubepi/multi-turngit clone --depth 1 https://github.com/cubeplexai/cubepiWrote 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.
[](https://agentmods.dev/agents/cubeplexai/cubepi/multi-turn)<a href="https://agentmods.dev/agents/cubeplexai/cubepi/multi-turn"><img src="https://agentmods.dev/badge/agents/cubeplexai/cubepi/multi-turn.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00017 | $0.01353 |
| Opus 5 | $0.00009 | $0.00677 |
| Sonnet 5 | $0.00003 | $0.00271 |
| Haiku 4.5 | $0.00002 | $0.00135 |
Grade A, and why
multi-turn 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 5d 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.
How it starts
The opening of the file, as written. The whole thing — 164 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Multi-turn Conversations
A "turn" in CubePi is one round of: user input → model response (and
maybe tools) → optional more model responses to tool results. The
agent's _messages list grows across turns; this guide covers how to
drive multi-turn flows correctly and how to inject input while the
agent is mid-thought.
The basic pattern
Just call prompt again after the previous call returns:
await agent.prompt("Hi, my name is Sam.")
await agent.prompt("What's my name?")
# → "Your name is Sam."
History lives on agent.state.messages. CubePi appends each user
message, each assistant message, and each tool result. The provider
gets the full list every time, so context windows matter (see
Context Management below).
In-flight steering: agent.steer()
Sometimes the user has a correction or extra context while the model
is still mid-turn. Use steer():
import asyncio
async def main():
task = asyncio.create_task(agent.prompt("Plan a 5-day trip to Kyoto."))
await asyncio.sleep(2)
# User changed their mind:
agent.steer(UserMessage(content=[TextContent(text="Make it 3 days, not 5.")]))
await task
A steering message is enqueued; the loop picks it up between turns (in practice, between a tool batch and the next model call). The agent sees it before its next response — it's not lost.
steering_mode on Agent controls drain behaviour:
"one-at-a-time"(default) — one queued message per pickup point."all"— every queued message is drained at once.
Queued follow-ups: agent.follow_up()
follow_up is for "after the current run, start a new turn with
this." It's the typical pattern for a chat UI: the user types while
the assistant is still responding.
agent.follow_up(UserMessage(content=[TextContent(text="And what about Osaka?")]))
# When the current prompt() finishes, the loop picks this up
# automatically and starts a new turn.
If the agent is idle when you call follow_up, you still need to
trigger a run — most apps call await agent.resume() once prompt()
returns, to drain the queue.
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.
- 5d ago First seen · 164 lines · 17 tokens per session scan A 08e74d132041
multi-turn is an agent published in the GitHub repository cubeplexai/cubepi (46 stars, last pushed 3d ago), licensed MIT. It adds 17 tokens to every session and 1,353 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.
Other agents, from other repositories
llm-integrator
LLM integration: OpenAI/Anthropic/Ollama APIs, prompt templates, function calling, streaming, token cost optimization.
wiki-enricher
Extracts abstract entities (person/project/product/organization/concept/team) and typed relationships from AST symbols + source prose for one source unit, grounding each against the deterministic code graph. Runs in the post-AST enrich phase, before planning.
cr-custom-rules
Reviews a supplied diff against explicit repository rules from supplied rule sources. Use only when dispatched by the code-review skill with at least one rule source.
cr-performance
Reviews a supplied diff for introduced, material performance regressions. Use only when dispatched by the code-review skill.
cr-security
Reviews a supplied diff for introduced, practically exploitable security vulnerabilities. Use only when dispatched by the code-review skill.
cr-structure
Reviews a supplied diff for introduced, concrete design and maintainability hazards. Use only when dispatched by the code-review skill.