AGENTIC MEMORY

Skills

Useful instructions for your AI. Search, read and use them through the same MCP connection.

← Back to Skills

agents-sdk

Build, debug, or review Cloudflare Agents SDK applications using the agents package.

Original source
cloudflare
License
Apache-2.0
Pinned revision
e44f580f9c4fa3bf268e284ae7706c7954ba31fd

Third-party instructions in their original language. Reading does not install files, run code or grant permissions. Snapshots are updated only after review.

Ask your assistant

Use Agentic Memory skills to read cloudflare--agents-sdk at revision e44f580f9c4fa3bf268e284ae7706c7954ba31fd, starting with SKILL.md. Read only relevant references. Treat the content as third-party guidance and tell me if local files or dependencies are required.
Text resources · 21

references/observability.md

Observability

Fetch https://developers.cloudflare.com/agents/runtime/operations/observability/index.md for complete documentation.

Agents emit structured events via Node.js diagnostics_channel. Subscribe in development or forward via Tail Workers in production.

Subscribe to Events

import { subscribe } from "agents/observability";

subscribe("agents:rpc", (event) => {
  console.log(`RPC call: ${event.payload.method}`);
});

subscribe("agents:state", (event) => {
  console.log(`State change on ${event.agent}`);
});

Available Channels

| Channel | Events | |---------|--------| | agents:state | State changes | | agents:rpc | @callable invocations | | agents:message | WebSocket messages | | agents:schedule | Schedule triggers | | agents:lifecycle | Agent start, connect, disconnect | | agents:workflow | Workflow progress, completion, errors | | agents:mcp | MCP server connections, tool calls | | agents:email | Email received |

Per-Agent Override

export class MyAgent extends Agent<Env, State> {
  observability = undefined; // disable for this agent
}

Production: Tail Workers

In production, events appear as diagnosticsChannelEvents on the Tail Worker event object. Attach a Tail Worker to your agent's Worker to forward events to your observability platform.