Skip to content

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.

  1. Pick what marks an agent’s request. Usually it is the prefix of the API key, for example myk_.

  2. Write the hook and set it on tt:

    from .vendor.telltale import ClientInfo
    def classify(request):
    auth = request.headers.get("authorization", "")
    if auth.lower().startswith("bearer myk_"):
    return ClientInfo("agent", "api-key")
    return None
    tt.classify_hook = classify

    The second argument names the client in the console. Returning None leaves the request to telltale’s own rules.

  3. 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.

  4. 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/
  5. 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.