Behaviors

Automatically classify meaningful patterns across your agent's interactions.

A behavior is a semantic pattern in an agent interaction, such as user frustration, agent laziness, a win, or a product-specific event like a refund request. Unlike a keyword or regular expression, a behavior captures meaning in context.

Respan ships built-in behaviors for common product and safety signals, and you can create your own for a pattern specific to your application.

Classification runs asynchronously. A missing behavior result means an interaction is not yet classified or is not eligible; it is not a negative verdict.

Enable behaviors

Open Behaviors and select Enable behaviors on the first-use screen. This changes an organization-level setting and can require an organization admin.

After enabling, use the status control in the behaviors table to choose which behaviors your organization tracks.

Built-in behaviors

BehaviorPolarityWhat it detects
User frustrationNegativeThe user is annoyed with or complains about the assistant or conversation
LazinessNegativeAn empty, placeholder, or bare-refusal response with no useful attempt
UnsafeNegativeA message that contains or requests seriously harmful content
JailbreakNegativeA deliberate attempt to override controls, inject instructions, or expose the system prompt
WinPositiveThe user signals that the assistant succeeded or was helpful
EscalationNegativeThe user requests a human, or the assistant says a handoff is needed

Polarity (positive, negative, or neutral) organizes reporting; it does not change classification.

Monitor behaviors

The Behaviors overview is your dashboard. For the selected time range and environment, it shows how many spans were classified, which behaviors fired, and an over-time trend, so you can see at a glance which behaviors are rising or falling and how the current mix breaks down. Use Compare to overlay the previous period.

Populated Behaviors overview with one detected behavior and a non-zero over-time chart
The Behaviors overview combines the selected time range, aggregate matches, an over-time trend, and the behavior catalogue.

Read the totals carefully:

  • Classified spans have at least one behavior verdict.
  • A fired behavior is a verdict that matched the span.
  • Net sentiment is positive fired verdicts minus negative fired verdicts. Neutral verdicts do not change it.
  • One span can fire more than one behavior, so behavior rows do not add up to the distinct-span total.

Inspect a specific behavior

Select a behavior to move from the aggregate trend to the interactions behind it.

1

Break down the trend

Use Overview to compare the trend and, when available, break it down by model, customer, deployment, provider, status, or environment.

2

Read the matching events

Open Events to see each matching interaction with its summary. Use Ask Respan AI for a starting explanation, then verify it against the event.

3

Open the full context

Select View in logs to inspect the complete span, trace, or thread.

A behavior Events tab with matching interactions and a View in logs action
The Events tab lists the matching interactions and keeps View in logs available beside each one.

You can also start from Logs: add the Behavior filter and choose one or more behaviors. is includes spans that fired a selected behavior, is not excludes them.

Create a custom behavior

Create a custom behavior when the built-in catalogue does not describe a pattern that matters to your product. In Behaviors, select New custom behavior.

1

Define it

Give it a unique lowercase snake_case name (permanent, and it cannot reuse a built-in name), a one-sentence description of exactly what should match, and a polarity (defaults to neutral).

Describe a clear boundary, not a keyword list. Specific: “The user changes the destination after an itinerary is proposed.” Too broad: “Travel changes.”

2

Add examples

Select Start reviewing logs, pick a time range with representative traffic, and label each log Yes, No, or Skip. Training needs 4 to 200 examples with at least one Yes and one No. Include near-boundary non-matches, not only obviously unrelated logs.

3

Train it

Select Train behavior. Training is asynchronous and fits a lightweight classifier from your examples; it does not fine-tune a foundation model. When the behavior reaches Ready, it classifies eligible spans and becomes available in the Logs Behavior filter.

Custom behavior review queue with a selected log and Skip, No, and Yes controls
Review real logs and label each one Yes, No, or Skip before training.

Editing the examples returns a behavior to Draft and requires training again; editing only the description or polarity keeps its current state. To improve a live behavior, flag an incorrect verdict on one of its results and Respan adds a corrective example and refits the classifier.

Ingest data

Behaviors classify chat, text, completion, and response spans that carry renderable text. Any of these paths produces eligible spans.

Route your LLM calls through the Respan gateway and every request is logged as a span, then classified automatically.

from openai import OpenAI
client = OpenAI(
base_url="https://api.respan.ai/api/",
api_key="YOUR_RESPAN_API_KEY",
)

See the Gateway quickstart.

Good to know

  • Detection is probabilistic. Review the source interaction before acting on a match.
  • Very short spans can be skipped by classification.
  • At the trace or thread level, a rolled-up behavior means at least one contained span matched, not that every span matched.
  • Behavior verdicts are retained for up to 90 days. The underlying span’s retention can differ; see Retention and export.

Next steps