Sub-agent names: opt-in telemetry label (`telemetryName()`) and docs on where the name is stored
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]):_warnFacetScheduledTasksDisarmeddoesconsole.warn(\[Think] Sub-agent "${this.name}" declares ${declaredCount} scheduled task(s) ...`)`. - NOT RE-VERIFIED here: the diagnostics
namefield 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(columnsname,identity_name;record()inserts both);cf_agents_facet_namein the facet's storage, written ininit(name, parentPath, identityName)(which throwsFacet bootstrap mismatchif the routed name differs fromidentityName, 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).
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?
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.
Understood, thanks for clarifying.