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/cloudflare/agents/readonly-connectionsgit clone --depth 1 https://github.com/cloudflare/agentsWhat 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.00000 | $0.02198 |
| Opus 5 | $0.00000 | $0.01099 |
| Sonnet 5 | $0.00000 | $0.00440 |
| Haiku 4.5 | $0.00000 | $0.00220 |
Grade A, and why
readonly-connections 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 yesterday.
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 — 279 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Readonly Connections
Readonly connections restrict certain WebSocket clients from modifying agent state while still letting them receive state updates and call non-mutating RPC methods.
Overview
When a connection is marked as readonly:
- It receives state updates from the server
- It can call RPC methods that don't modify state
- It cannot call
this.setState()— neither via client-sidesetState()nor via a@callable()method that callsthis.setState()internally
import { Agent, type Connection, type ConnectionContext } from "agents";
export class DocAgent extends Agent<Env, DocState> {
shouldConnectionBeReadonly(connection: Connection, ctx: ConnectionContext) {
const url = new URL(ctx.request.url);
return url.searchParams.get("mode") === "view";
}
}
// Client - view-only mode
const agent = useAgent({
agent: "DocAgent",
name: "doc-123",
query: { mode: "view" },
onStateUpdateError: (error) => {
toast.error("You're in view-only mode");
}
});
Marking connections as readonly
On connect
Override shouldConnectionBeReadonly to evaluate each connection when it first connects. Return true to mark it readonly.
export class MyAgent extends Agent<Env, State> {
shouldConnectionBeReadonly(
connection: Connection,
ctx: ConnectionContext
): boolean {
const url = new URL(ctx.request.url);
const role = url.searchParams.get("role");
return role === "viewer" || role === "guest";
}
}
This hook runs before the initial state is sent to the client, so the connection is readonly from the very first message.
At any time
Use setConnectionReadonly to change a connection's readonly status dynamically:
export class GameAgent extends Agent<Env, GameState> {
@callable()
async startSpectating() {
const { connection } = getCurrentAgent();
if (connection) {
this.setConnectionReadonly(connection, true);
}
}
@callable()
async joinAsPlayer() {
const { connection } = getCurrentAgent();
if (connection) {
this.setConnectionReadonly(connection, false);
}
}
}
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.
- yesterday First seen · 279 lines · 0 tokens per session scan A 8d35a8dfa818
readonly-connections is an agent published in the GitHub repository cloudflare/agents (5,498 stars, last pushed 2d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,198 tokens. 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
arxiv-2307-07191
Agent "arxiv-2307-07191" from SAIRAMANALADI/vybe-intelligence-vault, covering summary, why it matters, paper metadata and key topics & tags.
0x4m4-hexstrike-ai
Explain why this repository is useful for advanced web development, 3D frontend, animations, UI systems, or creative development.
0xsteph-pentest-ai-agents
Explain why this repository is useful for advanced web development, 3D frontend, animations, UI systems, or creative development.
15-updates-from-google-i-o-2026-powering-the-agent
General public resource representing technology updates, guides, or tutorials.
amap-ml-longhorizon-harness
Explain why this repository is useful for advanced web development, 3D frontend, animations, UI systems, or creative development.
24-i-cset-awesome
General public resource representing technology updates, guides, or tutorials.