agents icon indicating copy to clipboard operation
agents copied to clipboard

Sub-agent names: opt-in telemetry label (`telemetryName()`) and docs on where the name is stored

Open MRCORD opened this issue 1 month ago • 3 comments

Hi. Context: we build a library for agents that handle sensitive conversations. A sub-agent name can hold an identifier chosen by the app (e.g. a thread named after a phone number).

Related: the span-attribute issue, https://github.com/cloudflare/agents/issues/2789

Ask 1: a label-only override. Something like telemetryName() on Agent (default return this.name), used wherever the name is a label, not a key: native span attributes (see the related span-attribute issue), the name on diagnostics events, and Think's warning. An app could return an opaque token.

  • READ (@cloudflare/[email protected]): _warnFacetScheduledTasksDisarmed does console.warn(\[Think] Sub-agent "${this.name}" declares ${declaredCount} scheduled task(s) ...`)`.
  • NOT RE-VERIFIED here: the diagnostics name field on _emit.

Ask 2: documentation. The name is a routing key and cannot be replaced, so the request is only to document where it is stored verbatim ([email protected], READ):

  • cf_agents_sub_agents (columns name, identity_name; record() inserts both);
  • cf_agents_facet_name in the facet's storage, written in init(name, parentPath, identityName) (which throws Facet bootstrap mismatch if the routed name differs from identityName, so it is a key);
  • cf_agents_parent_path, which holds the ancestors' names.

Repro (synthetic; READ, not RUN)

const child = await this.subAgent(Messenger, "messenger:fake:+15550100");
// root SQL: SELECT name, identity_name FROM cf_agents_sub_agents  -> both hold the name
// facet storage: cf_agents_facet_name, cf_agents_parent_path   -> hold the name
// Think, class with scheduled tasks: [Think] Sub-agent "messenger:fake:+15550100" declares ...

Happy to adapt the shape (e.g. a hook instead of a method).

MRCORD avatar Nov 02 '26 14:11 MRCORD

Hi, I’d like to take this on. I’d trace where agent names become telemetry labels, introduce an override at that boundary, and document the storage locations that still need the routing identity. I’d test that an override changes labels without affecting sub-agent lookup. Would you prefer a protected hook or a public telemetryName method?

darshpatel1052 avatar Nov 03 '26 05:11 darshpatel1052

Thanks for the report. We triaged it and are closing it as not planned. Few users use personal data as sub-agent names, and a new telemetry-name API would be public surface we'd maintain for good. The name is the routing key, so its storage is inherent. A maintainer can reopen this if there's new evidence of wider impact.

github-actions[bot] avatar Nov 03 '26 16:11 github-actions[bot]

Understood, thanks for clarifying.

darshpatel1052 avatar Nov 03 '26 18:11 darshpatel1052