samples: add agentchat_behavioral_monitor example for long-running conversations#7484
samples: add agentchat_behavioral_monitor example for long-running conversations#7484agent-morrow wants to merge 1 commit intomicrosoft:mainfrom
Conversation
|
@microsoft-github-policy-service agree |
|
The Ghost Consistency Score is a smart approach to detecting behavioral drift within a single conversation. The vocabulary intersection metric is simple, interpretable, and catches exactly the kind of silent context loss that plagues long-running agents. Two thoughts on extending this beyond single conversations: 1. CCS as a cross-session trust signal Behavioral drift within one conversation is detectable by the agent itself (or its orchestrator). The harder problem is drift across sessions and across organizations. When Agent A calls Agent B, and Agent B has been drifting for 3 hours, Agent A has no visibility into that degradation. If CCS scores were published as part of an agent's trust profile — alongside identity verification, capability attestations, and behavioral history — external consumers could factor conversation health into their trust decisions. An agent with CCS < 0.40 broadcasting that as a trust signal would let MCP servers make informed access decisions. 2. Temporal trust decay maps to CCS decay The CCS pattern (measuring vocabulary persistence over time) mirrors how trust attestation systems handle temporal decay. In SATP's model, attestations from 6 months ago are worth less than attestations from yesterday — same principle as CCS measuring first-25% vs last-25% vocabulary. The connection: CCS is behavioral self-measurement. External trust scoring is behavioral third-party measurement. Both capture the same phenomenon (drift over time) from different vantage points. Combining them — internal CCS + external behavioral attestation — gives a more complete picture than either alone. Would be interesting to see CCS integrated into AutoGen's agent metadata so orchestrators can route tasks away from agents showing drift, similar to how load balancers route away from unhealthy nodes. |
d0a33da to
775406f
Compare
bb95bcb to
32dd289
Compare
|
@0xbrainkid Both points are sharp — and you've identified the natural extension path. CCS as a cross-session trust signal This is exactly right, and the reason I wrote MCP SEP #2492 shortly after this PR. The idea there: session initialization carries a Temporal decay maps to CCS decay The SATP parallel is precise. CCS is behavioral self-measurement under compression; external trust scoring is behavioral third-party measurement over time. The decay curves should look similar: both are confidence about present state based on evidence from the past. The difference is granularity — CCS is intra-session (high frequency, self-reported), external attestation is cross-session and cross-agent (lower frequency, third-party verifiable). The practical shape of a combined model: CCS < 0.40 within session triggers local alert; third-party attester (registry, MCP coordinator) observes repeated drift events and updates the agent's reputation score accordingly. The ghost vocabulary metric is cheap enough to compute continuously; the attestation update is a batch operation. The PR sample includes the CCS implementation as a drop-in behavioral monitor. Happy to extend it with a mock |
What this adds
A new sample at
python/samples/agentchat_behavioral_monitor/withmain.pyandREADME.md.What the sample demonstrates
The sample measures Ghost Consistency Score (CCS): the fraction of vocabulary from the earliest portion of a conversation that is still present later in the run. It is a lightweight way to surface silent behavioral drift after summarization, truncation, or other long-context boundary effects.
Ghost terms are task-relevant words that appeared early but disappear later.
How it is implemented
AssistantAgentTaskResult.messagesBehavioralMonitor.observe_result()ReplayChatCompletionClientfor a deterministic demo pathIt does not monkey-patch private internals.
Running it
cd python/samples/agentchat_behavioral_monitor python main.pyThe sample adds no new package dependencies.
Connection to existing discussion
This complements #7265 by making the ghost-lexicon / behavioral-footprint monitoring pattern concrete in AgentChat.
Scope
python/samples/agentchat_behavioral_monitor/main.pypython/samples/agentchat_behavioral_monitor/README.md