Skip to main content

Signals

How rule discovery actually works​

Signals are example customer messages that teach Parlant when a rule should come into a conversation. Anti-signals are near-misses that teach it when the rule should stay out. Parlant generates a starter set for every rule, and you add the phrases your customers use. When a rule comes up too often or too rarely, adjust its signals first.

What you'll learn
  • How a rule's signals and anti-signals drive discovery
  • How the working set makes discovery sticky, and when it is pruned
  • How to pin a phrasing that must never be missed
  • How to write signals that fix a rule that fires too much or too little
Talk this page through with your coding agent

Now that we have followed a turn end to end, let's go deeper into the mechanism that decides which rules enter the picture at all. It is worth understanding, because it is what you tune when a rule comes up too much, too little, or at the wrong time.

Rules learn from examples​

Recall that discovery is a cheap, similarity-based check. What it checks against is a set of examples attached to each rule.

A rule's signals are example customer messages that should bring it into the conversation: "my blender stopped working" for a warranty-claim rule, say. Its anti-signals are near-misses that should not. "What does the warranty cover?" is about warranties, but it is not a claim.

You do not have to write these from scratch. When your agent starts, Parlant proposes ten of each for every rule, based on the rule's content, and merges in any you have written yourself.

Note that for discovery, these examples matter more than how the rule itself is worded. If a rule is not coming up when it should, its signals are usually the first place to look.

Comparing the conversation to those examples​

On every turn, Parlant compares the conversation to each rule's examples. It looks at each customer message on its own, and at the conversation as a whole. So a rule can be discovered from something the customer said a few messages back, not only from the latest message.

Once a rule is discovered, it joins the session's working set (the rules your agent carries along for the session) and stays there. Parlant records it in the working set and does not keep re-checking it. That is what makes discovery sticky.

The working set is not unlimited, though. When it grows large, Parlant prunes rules the conversation has moved on from. A pruned rule only comes back if newer conversation brings it up again.

1
2
3
4
5
6
7
8
9
10 · prune
11
12
Refund procedure
Address change
Shipping times
Loyalty program
Exchanges
in the working sethigh weight, exempt from pruning
Five rules across twelve customer messages. A rule enters when a message discovers it and stays. When the set grows past thirty rules, a pass after message 10 prunes those the conversation has moved on from, sparing high-weight rules and that turn's matches. A pruned rule returns only when a later message discovers it again; message 4 alone could not bring 'shipping times' back.

Pinning a phrasing that must never miss​

Sometimes a phrasing is so clear-cut that you never want to leave it to similarity. For that, prefix a signal with [__pin__]. If a customer message is very close to it, the rule is discovered, full stop.

Writing good signals​

Knowing all this tells you how to write signals. Your coding agent adds them to the rule as signals and anti_signals lists:

  • Write signals in the customer's own words. Parlant compares against customer messages, so "my blender stopped working" lands closer than "product defect scenario".
  • Anti-signals are near-misses, not opposites. "What does the warranty cover?" teaches a claims rule its boundary. An off-topic sentence teaches it nothing.
  • A rule that fires too often needs anti-signals. Take the messages that wrongly triggered it and add them.
  • A rule that misses needs more diverse signals. Use genuinely different phrasings rather than ten paraphrases of one, and a pin for the phrasing that must never miss.
  • Signal edits need a restart. Parlant learns from signals at startup. Hot reload restarts and relearns when you save.
tip

Every discovery batch is logged at debug level under Rule discovery results, with each rule's score and verdict. When a rule surprises you, read that line before touching the rule.

Under the hood: how discovery scores a rule

Discovery is based on the Signals and Queries research paper. At startup, Parlant trains one small classifier per rule, a logistic-regression model over embeddings, using its signals as positive examples and its anti-signals as negative ones. Once a rule has both, its condition text is no longer a training input.

At turn time, Parlant builds queries from the conversation: the whole conversation so far (prefixed by the session summary, if there is one), plus each customer message on its own.

Each rule not yet in the working set is scored against every query, on a scale where 0.5 is the line for "relevant", and takes the highest of those scores. That maximum is what lets an earlier message still discover a rule several turns later.

Once the rule is in the working set, it is no longer scored at all. The working set, not the scoring, is what keeps it in play.

A pinned signal bypasses the classifier. A customer message close enough to it discovers the rule regardless of the score.

An agent with five or fewer rules skips discovery entirely and renders them all. And when the working set passes thirty members, a pass after the reply prunes it back to twenty, sparing high-weight rules and this turn's matches.