Observability Traces Metadata

Metadata

Governed model calls are traced automatically. Metadata adds application labels and groups related calls into sessions. User attribution has an authenticated default; you can also supply your application's end-user ID.

What metadata is

Metadata is a set of your own key-value pairs, attached to a call at the time it is made. Forgebench does not interpret most of what you send; it is recorded and made available for filtering exactly as sent. A small number of keys are treated specially because they drive a particular view in Forgebench rather than acting as a plain filter.

What is already attached, without you sending anything

Alongside anything you send yourself, Forgebench writes a further set of information onto governed-call traces automatically. Authenticated agent, actor, key, and audit IDs come from the server. Your application labels and end-user IDs do not change those identities or grant access to trace content:

FieldWhat it is
agent_idWhich agent made the call, when it was made by an agent rather than a direct API call.
actorThe identity of the person or service account that authenticated the call.
audit_idThe entry in the audit log for this exact call.
api_key_prefixThe non-secret, displayable prefix of the API key used to make the call (for example, sk_ab12...), never the key itself, which Forgebench never stores in a recoverable form.
requested_modelThe model requested, useful when a fallback model ended up serving the call instead.
latency_msThe true time the call took at the gateway.
user_idThe Users grouping. By default, your account email, identity ID, or key prefix identifies the caller. Deployments with agent attribution group agent calls by agent ID. An explicit end-user ID can replace this grouping without changing the authenticated actor.

Sending metadata

Metadata is sent as a metadata.dimensions object alongside the rest of the call. Each entry in it becomes both a filter you can search on later and part of the permanent record of that call.

from forgebench import Forgebench

client = Forgebench(api_key="sk_...", base_url="https://api.forgebench.ai")

resp = client.chat.completions.create(
  model="mock-gpt",
  messages=[{"role": "user", "content": "Hello"}],
  extra_body={
      "metadata": {
          "dimensions": {
              "feature": "checkout-assistant",
              "session": "conv_8f21",
              "customer": "acct_4471",
          }
      }
  },
)

The TypeScript SDK declares metadata, dimensions, user, session_id, and tags on ChatCompletionRequest. Its dimensions convenience field is merged into metadata.dimensions. The API also accepts top-level user for your end-user ID and session_id for a conversation. SDK trace-level user and session fields can be set with the tracing helpers.

Dimensions with special meaning

KeyWhat it does
dimensions.featureNames the call, in place of the generic default. Use this to tell apart different kinds of calls your application makes, such as checkout-assistant versus order-lookup.
dimensions.sessionGroups every call sharing the same value into one session. See Sessions for the full picture.
dimensions.schoolAlso sets the trace's environment field, after environment-name validation.

Any other key is your own choice, and is recorded as a plain, searchable filter, for example dimensions.customer. Reserved attribution keys are ignored.

Limits

LimitValue
Keys per call8
Key format1–40 characters, starting with a letter, followed by lowercase letters, numbers, underscores, or hyphens. Keys are trimmed and lowercased.
Reserved keystenant, agent, key, run, tenant_id, agent_feature, server_feature
Value length128 characters, beyond which the value is shortened

Only the first eight valid, nonempty dimensions are kept. Null and empty values are ignored. Dimensions are retained as identifiers for filtering, so use opaque IDs rather than secrets or personal data.

Next

Cookie settings

Our Cookie Policy lists every cookie and what it does.