Manuscript Offprint

arXiv:2610.29326

Signals and Queries: Token-Efficient Agentic Context Discovery

Yam Marcovitz

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

User-facing LLM agents must identify which behavioral policies apply at each turn, but evaluating every policy with an LLM is costly. We introduce Signals and Queries (S&Q), a lightweight first-stage relevance filter developed for Parlant 4.0 that removes at least 30% of candidate policies before downstream evaluation while preserving high recall. For each policy, an LLM generates activating examples and hard negatives offline. An independent logistic classifier trained on their embeddings then predicts relevance using embeddings and vector dot products, with no per-turn LLM calls. This shifts expensive relevance evaluation to a smaller candidate set, while allowing each policy's classifier to be updated independently. Evaluated against 9,144 LLM-judge relevance labels covering 254 τ2\tau^{2}-bench conversation prefixes and 36 airline policies, S&Q achieves higher precision than top-K and cosine-threshold retrieval at every evaluated recall level, with consistent results across two embedding providers. These findings support inexpensive, per-policy classification as a practical first stage for reducing downstream evaluation workload in customer-facing agents.

1 Introduction and Motivation

Agentic LLM applications increasingly separate what the agent could know from what the agent should see right now. A customer-facing agent may be governed by dozens of behavioral policies; it may also carry a domain glossary, tool and skill descriptions, state observations, and reference documents. Placing all of it in every prompt is expensive and counterproductive, for three well-documented reasons. Long contexts suffer from the lost-in-the-middle effect: models systematically under-attend to information positioned in the middle of the prompt [1]. They suffer from attention dilution: as the prompt grows, the attention mass allotted to any individual instruction shrinks, so its influence on generation fades [2]. And they suffer from the curse of instructions: the probability of following all instructions decays approximately as the per-instruction success rate raised to the number of instructions, so adherence degrades steadily as inventories grow [3]. On top of these quality failures, per-turn token cost scales linearly with inventory size rather than with what the turn actually needs.

The problem is acute for policies. In behavioral governance frameworks such as Parlant [4], policies are normative instructions (“only compensate if the customer holds travel insurance…”) whose omission is a correctness failure, not merely a quality regression: an agent that does not see the cancellation policy while handling a cancellation may take actions it should have refused. Relevance filtering for policies is therefore a recall-critical problem: a false negative can produce a policy violation, while a false positive merely wastes a few hundred prompt tokens that modern models tolerate well. This asymmetry drives the design of everything that follows.

One accurate solution is to ask an LLM, per turn and per policy, “is this policy relevant now?”; this is the first-pass ranker used in Parlant’s engine. It works, but its cost scales with the inventory: for our 36-policy benchmark it consumes ~69,000 prompt tokens and 36 LLM calls per user turn (§4.4). The alternative, embedding-based retrieval of the policy text against the conversation, is nearly free but suffers from a genre gap: conversations are informal user utterances while policies are formal normative prose, and their embeddings separate poorly [5]. A third architecture avoids the problem by construction: routed flow-graphs place different instructions at different nodes, so each prompt stays small. But this fragments the agent’s knowledge. Real customer conversations are multi-turn and multi-topic, and drift freely across node boundaries. The node in control at any given moment often lacks policies the situation has come to require, so the agent is least coherent on the messy, multi-topic conversations that matter most. A fourth approach, taken by skill-based agent frameworks [6, 7], keeps only a short description of each skill resident and loads a skill’s full instructions on demand, once the model, reasoning over those descriptions, decides it applies. This keeps whole instructions out of the prompt, but makes discovery part of the model's own reasoning loop, slower and costlier than an out-of-loop lookup.

We propose Signals and Queries (S&Q): describe each artifact not (only) by its text but by signals (LLM-generated examples of user messages that should activate it) and anti-signals (hard near-misses that should not). A tiny per-artifact classifier trained on these exemplars then scores live conversation turns (queries) in the embedding space. While we develop and evaluate S&Q on agent policies, nothing in the formulation is policy-specific: any context artifact that can be described by exemplar activating queries is a candidate target, including state observations, glossary entries, skills and tools [8, 9], and code or document sections.

Contributions. (1) A formulation of agentic context discovery as recall-first, per-artifact binary relevance, decided by classifiers over LLM-generated signals and anti-signals; the design is decoupled: each artifact's classifier and threshold depend only on its own exemplars, so adding or editing an artifact retrains nothing else. (2) A benchmark against an LLM judge on τ2\tau^{2}-bench conversations [10, 11] with 36 policies, comparing four embedding-retrieval baselines; S&Q Pareto-dominates all of them and replicates across two embedding providers. (3) A cost analysis showing a ∼105×\sim10^{5}\times reduction in per-turn cost relative to per-policy LLM ranking. (4) An analysis of failure modes showing that signal and anti-signal quality (coverage, hardness, and domain match) is the dominant factor, motivating exemplar generation as a research problem in its own right.

This work continues our ongoing pursuit of accuracy in customer-facing agents at Parlant. It complements our earlier work on Attentive Reasoning Queries [12], which optimizes instruction-following once the relevant policies are already in the agent's context; S&Q addresses the upstream problem of discovering which policies belong there in the first place.

References (26)