Skip to main content

Filter Language

The syntax, the keys, free words, limits and error messages of the filter bar on the Traces page. The Sessions and Agents pages, alert rules and dashboard charts use the same language.

Filter in the dashboard, or with an API key through the MCP server

What runs today: the filter bar of the Traces, Sessions and Agents pages reads this language. Alert rules and dashboard charts read it too.

With an API key: the REST API has no route that reads traces or checks a filter. The MCP server does: its tools list_traces, list_sessions and list_agents take a filter in this language. The REST API reference lists the routes that a key can reach.

You write a filter as one line of terms. A trace must match every term. Press Enter to apply the filter. The bar shows each applied term as a chip with a remove button. The page address holds the filter, so you can share the link.

Syntax

Separate terms with a space. A term is a key with a value, or a free word.

TermMeaning
key:valueThe key equals the value
key!=value or -key:valueThe key does not equal the value. A chip shows both as key!=value
key>value, key>=value, key<value, key<=valueCompare a number or a duration
word, "a phrase", -wordA free word, a phrase, or a word that must not match. See Free words
error:true model:gpt-4o duration>2s
env:production -tag:canary
model:gpt-4o model:gpt-4o-mini cost>0.5
  • Repeated key. When you repeat the same key with :, a trace matches if it has any of the values. Terms with different keys must all match.
  • Case. A key does not depend on case: ERROR:true works. The name after score. or attr. keeps its case.
  • Negation. Put - before a term. A negated key term takes : only. -duration>2s is refused. Write duration<=2s.
  • Comparisons. >, >=, < and <= work on number keys, duration keys and score.<name>. A text key, error and probes take : and != only.
  • Numbers. Digits with an optional decimal part, such as 5 or 0.5. A sign, an exponent and a thousands separator are not allowed.
  • Durations. A number with ms, s, m or h: 500ms, 2s, 1.5m, 1h. A number alone means milliseconds.
  • Quotes. Put a value in double quotes when it has a space, a quote or a colon: tag:"needs review". A backslash takes the next character as it is, so \" is a quote inside quotes. A space must follow the closing quote.

Keys

The language has 27 keys and two prefix keys. A key takes text unless the table says another form.

KeyMatches
traceThe start of the trace ID
session, userThe session ID, the end-user ID
agent, agent_idThe agent name, the agent ID
env, environmentThe environment. The two keys are the same
releaseThe release of the trace: the release of its earliest span that has one
tagA tag on the trace
model, providerThe model (the canonical name or the raw name), the provider
prompt, prompt_versionThe prompt name, the prompt version
prompt_hashThe first 8 to 64 hexadecimal characters of the prompt hash
toolThe name of a tool that a span calls
rootThe name of the root span, exact
experimentA run ID, any or none. See Hidden traces
probesshow or hide. See Hidden traces
errortrue or false. A trace has an error when one of its spans failed
error_codeThe error code of a span. See Error codes
error_messageThe status message of a failed span, exact text
durationThe duration of the trace. A duration, such as 2s
costThe cost of the trace in USD. A number, such as 0.5
tokensThe total tokens. A number
spansThe number of spans. A number
llm_errors, tool_errorsThe number of failed LLM calls, the number of failed tool calls. Numbers
score.<name>The latest score of that name on the trace
attr.<key>The exact value of a span attribute

prompt, prompt_version and prompt_hash must hold on the same LLM span. The filter prompt:support prompt_version:4 keeps a trace that has one span with both. See Use a Prompt in Code.

score.<name>. A comparison needs a number, and a true or false score counts as 1 or 0. : and != match a label, true, false or the number. Examples: score.quality<0.5 and score.resolved:true. The time of the score must be in the time range or up to 7 days after it. A score term that keeps traces reads at most 10,000 of them. See Scores and Labels.

attr.<key>. It takes : and != only, for example attr.http.method:GET.

A name after score. or attr. may have letters, digits, _, . and -. Quote a name with any other character: score."user rating":4 and attr."http status":500.

Free words

A word without a key matches a trace in three cases:

  • A span attribute value holds the word. These values are prompts, answers, tool arguments and model names. The match is on whole tokens and does not depend on case.
  • The name of the root span contains the word.
  • The trace ID starts with the word.

Put the word in quotes to match a phrase. Put - before a word to leave out the traces that match it. Two words must both match.

Risicare stores content after it removes credentials and personal data, so a removed value cannot be found. A project with content capture off has no content to find. A free word still matches root span names and trace IDs then. See Projects.

A free word reads at most the 10,000 newest matching spans of the time range. At that limit the list says "Showing matches in the first 10,000 spans of this window. Narrow the window." A row that matched on content shows a snippet under its name, with the attribute key. Click the snippet to open the trace on that span.

Special forms

  • Trace ID. A bare word of 32 hexadecimal digits becomes trace: and the ID when you apply the filter. This holds alone or beside other terms. In quotes, or after -, it stays a free word.
  • Span ID. When the filter is one bare word of 16 hexadecimal digits, the Traces bar opens the trace that holds that span. It looks in the time range of the list. If the span is outside the range, the bar says "No span with this id in the selected range."

Error codes

error_code: matches the typed error code of a span: error_code:TOOL.EXECUTION.TIMEOUT, error_code:ECONNRESET or error_code:429. A code has letters, digits and the characters _ . : / -, with at most 128 characters. It is either dotted or has no lower-case letter.

A value that is not shaped like a code, such as timeout or rate limit, is read as error_message: with the same text. The chip shows error_message and a tooltip says so. See Error Taxonomy.

Limits and error messages

A filter has at most 2,048 characters and 32 terms. The bar checks the filter when you press Enter. If the filter has an error, the bar keeps your text, does not change the page address, and shows the first error under the bar. The message ends with "At character N." and a line with a caret points at the character. The list gives way to one line while the bar holds the error: "The filter is not applied: the message under the filter bar says why. Fix or remove the term to load traces." A link with an invalid filter shows the same line. The bar shows the first error it finds. It checks the length first, then the syntax from left to right, then the number of terms, then each term from left to right. For one term it checks the last four rows of this table in the order shown.

ProblemMessage under the bar
More than 2,048 charactersThe filter is longer than 2,048 characters.
A quote with no closing quoteThe quote is not closed.
A quote inside a word, or text after a closing quoteA quote cannot start inside a term. Quote the whole value. Or: Add a space after the closing quote.
An operator with no keyAn operator needs a key before it.
- with != or a comparisonUse model!=value or -model:value, not "-" with "!=".
More than 32 termsThe filter has more than 32 terms.
A key that does not existUnknown key "foo". The bar adds the list of keys.
A key with no valuemodel needs a value.
A comparison on a text key">" does not apply to model. Use : or !=.
A value that the key refuseserror takes true or false. Or: cost takes a number, such as 0.5 or 1000. Or: duration takes a duration: 500ms, 2s, 1.5m, 1h, or a number of ms. Or: prompt_hash takes the first 8 to 64 hexadecimal characters of a prompt hash.

Suggestions

Use the arrow keys to move in the list, Enter or Tab to take a suggestion, and Escape to close the list. Enter with no suggestion selected applies the filter.

  • A key prefix lists up to 8 keys, each with a one-line description. A number or duration key ends with >. score. and attr. appear as prefixes.
  • error: lists true and false. probes: lists show and hide. experiment: lists any and none.
  • score. lists the score names of the project with their type and count. The names load when you first type score.. After a true or false score and :, the bar offers true and false.
  • These keys list values with the number of traces: env, environment, agent, error_code, model, tag, user and release. The bar shows up to 10 values, counted over the time range and the filter of the page. It loads them when the bar takes focus. If they do not load, it says "The values did not load; type a value."

Hidden traces

Two kinds of traces stay out of the Traces list until the filter asks for them.

Probe traces. Probe traces (root span control-channel-probe) are hidden until the filter asks for them. A banner counts them: "N probe traces hidden in this window". Show adds probes:show to the filter. A root: term shows them too, unless the term is negated (-root:name or root!=name). When they are shown, Hide removes the probes: terms. The banner is not drawn when the filter has a root: term that is not negated, or a probes: term other than probes:show.

Experiment traces. A trace belongs to an experiment when its spans carry the attribute risicare.experiment.id, as the trial traces of a run do. The list leaves these traces out unless the filter has an experiment term. A note under the bar says "Experiment traces are hidden. Add experiment:any to see them." See Find the trial traces.

  • experiment:any keeps the traces that belong to an experiment.
  • experiment: and a run ID keeps the traces of that run. Repeat the term for more runs.
  • experiment:none keeps the traces with no experiment. This is the default, written out.
  • -experiment: and a run ID, or experiment!= and a run ID, keep the traces of other runs and the traces with no experiment.

any and none are words in every case, not run IDs. The note under the bar changes with your terms.

Presets and the address

Presets replaces the filter with one of six filters. When the filter equals a preset, the button shows its name.

PresetFilterTraces that
Errorserror:trueHave at least one failed span, also a failed tool call under a successful answer
Tool errorstool_errors>0Have a failed tool call
LLM errorsllm_errors>0Have a failed model call
Slowduration>10sTake more than 10 seconds
Expensivecost>1Cost more than one dollar
Long runsspans>=20Have 20 or more spans

The applied filter is the filter parameter of the page address. A new filter returns the list to its first page. Clear filters shows when the filter has terms to clear. It keeps the time range, the columns and the sort, and it keeps probes:show if the filter had it. A link from before the filter language (with q or typed keys) is not read, and a notice says so.

Other pages

  • Sessions. The bar takes every key except trace, root and probes, and no free word. A key it does not take is refused, for example "'trace' applies to traces, not to sessions." duration is the wall-clock time of the session. cost, tokens, spans, llm_errors and tool_errors are sums over the session. score.<name> reads the scores recorded on the session itself. A score on a trace does not count. A score term covers the newest 10,000 scores only, and the page says so. See Sessions.
  • Agents. The bar takes every key and free word of the Traces bar. It counts agents from the traces the filter selects. It leaves probe traces out unless the filter has probes:show or a root: term that is not negated. A note under the bar says so. See Agents.

The Sessions and Agents bars have no Presets or Views menu. They suggest keys and fixed values, with no counts and no score names.

Alert rules and dashboard charts read this language too. A rule has a Filter: see Alerts. A chart has a filter, and some chart settings add limits: see Charts. To keep a filter with its columns and time range, see Saved Views.