How to label your agents
telltale recognizes many agents by their User-Agent, such as Claude-User, claude-code and ChatGPT-User. Many other agents call APIs through a plain HTTP library like python-requests, and telltale labels those requests script. If your app gives out API keys, your app knows more than the headers do, and a classify hook can label those requests correctly.
-
Pick what marks an agent’s request. Usually it is the prefix of the API key, for example
myk_. -
Write the hook and set it on
tt:from .vendor.telltale import ClientInfodef classify(request):auth = request.headers.get("authorization", "")if auth.lower().startswith("bearer myk_"):return ClientInfo("agent", "api-key")return Nonett.classify_hook = classifyThe second argument names the client in the console. Returning
Noneleaves the request to telltale’s own rules. -
Keep the hook to header checks. It runs on every request, before your app’s own sign-in, so it must not query the database.
-
If you ship your own command-line tool, list its User-Agent prefix so its requests are labeled
own_client:Terminal window export TELLTALE_OWN_CLIENTS=myapp-cli/ -
Check the result. Make a request with an agent key, then look at the console’s Stats tab, or run
telltale summary. Both split requests and errors by client type.
How it works lists the order of telltale’s own rules.