Skip to content

v2.0.1: GroundedSignal — provenance-tagged reward/quality signal shared across AgentSwarm, CostQualityRouter, SelfImprovingAgent #822

Closed

Description

@AmitoVrito

Summary

Extract a reusable GroundedSignal / provenance primitive: a way to tag any learning-relevant score (reward, quality, cost, confidence) with whether it came from an independently verifiable source or from the same agent/process grading its own work. Consumers (reputation stores, routers, eval gates, audit trails) treat ungrounded signal as discounted/filterable evidence instead of silently trusting it as ground truth.

This is infrastructure, not a feature — it's a small dataclass and a convention, not a new subsystem. The goal is that every place SynapseKit currently lets a number flow from "agent says X" into "the system now believes X" gets the same one honest question attached to it: who is vouching for this number, and can I tell the difference between vouching and repeating?

Motivation

This came out of a review discussion on #734 (AgentSwarm) with @clementineCU: AgentSwarm._actual_quality() currently falls back to a winning agent's own estimated_quality from its bid when no external reward/quality is supplied at execute() time, so the market's reputation store can update purely from an agent grading itself, with no external grounding. That's not a bug in AgentSwarm specifically — it's a design gap in how the whole framework represents "a number that influences future behavior." The same shape of question applies in at least three other places:

  • AgentSwarm / Reputation (v2.0: Agent Swarms with Emergent Specialization — market-based role negotiation #734) — reputation updates need to distinguish externally-supplied outcome scores from self-reported ones, or the market can reward agents for confidently repeating their own bids.
  • CostQualityRouter (v1.7.0) — the explore/exploit router learns from cost/quality observations to route future calls. If those observations are ever agent-self-reported rather than measured (e.g. a wrapped provider reporting its own "quality" heuristic), the router's Pareto-frontier stats are learning from noise dressed as signal.
  • SelfImprovingAgent (v2.0: Self-Evolving Agents — agents that rewrite their own prompts, tools, and routing rules #732, shipped in 2.0.0) — eval-gated config patches are supposed to be blocked on EvalSuite/FeedbackCollector signal. Worth auditing whether feedback that originates from the same agent instance being evaluated can currently pass the same gate as independently-collected user feedback.
  • VerifiableAgent (v2.0: Verifiable Agents — cryptographically signed audit trails of every LLM call and tool invocation #738, shipped in 2.0.0) — already solves an adjacent but distinct problem (tamper-evidence: "did this trace happen and is it unmodified"). It deliberately does not answer "was the content of the trace true" — a self-reported quality score can be faithfully, verifiably, cryptographically signed and still be wrong. GroundedSignal is the missing piece that sits inside an audited trace and says whether the number itself deserves trust, not just whether the record of it is intact. These two are complementary and should compose (see Design Philosophy).

Rather than solving "is this number trustworthy" three or four times with three or four different ad hoc conventions (a source string here, a bool flag there, nothing at all somewhere else), this issue is a bet that pulling it out once, early, while only one consumer (#734) actually needs it yet, is cheaper than reconciling four incompatible schemes later once CostQualityRouter, SelfImprovingAgent, and whatever v2.1 features route on top of them have each grown their own.

Prior art

The core problem is well studied outside agent frameworks, even though no competing agent framework (AutoGen, CrewAI, LangGraph, DSPy) has a market/reputation/routing mechanism sophisticated enough for this question to have come up yet — this is genuinely ahead of where the ecosystem's conventions are, not behind them.

  • RLHF reward hacking — training a policy on a reward signal the policy itself can influence (directly or by learning what the grader wants to hear) reliably collapses into Goodhart's-law failure. The standard, boring, well-validated fix is: the reward model or human rater must be a separate process from the thing being scored. GroundedSignal.source is that separation made explicit and machine-checkable instead of an unstated assumption in someone's training pipeline.
  • LLM-as-judge evals — accepted practice is a different model or a fixed rubric grades output; self-consistency (the same model checking its own answer) is known to be a weaker signal and is typically used only as a cheap pre-filter, never as ground truth for anything downstream that matters.
  • The blockchain oracle problem — smart contracts structurally cannot trust self-reported on-chain data about real-world outcomes, so the entire "oracle" category of infrastructure exists purely to inject externally-attested data across that trust boundary. SignalSource.EXTERNAL_OVERRIDE is SynapseKit's oracle boundary.
  • Marketplace reputation systems (eBay, Uber, Upwork) — sellers/drivers cannot rate themselves; ratings must come from the counterparty. Byzantine-robust aggregation in federated learning goes further and doesn't outright ban unverified updates, it down-weights them — which is closer to the "discount, don't refuse by default" stance below than a hard ban.
  • Observability / SRE practice — distinguishing a metric that's measured (latency from a load balancer) from one that's emitted (a service self-reporting its own health) is a basic maturity signal in monitoring systems; self-reported health checks are notoriously unreliable exactly because the thing under scrutiny controls the report.

Design Philosophy

These are the principles this issue is committing to, in priority order. If a later design decision conflicts with one of these, the earlier principle in the list wins.

  1. Skeptical by default, not paranoid by default. The default posture is "unknown provenance is treated as ungrounded," not "unknown provenance throws an error." Most of the codebase, most of the time, will not have an external judge wired up — that's normal, not a misconfiguration. GroundedSignal should make the ungrounded case a labeled, first-class, still-functional path, not a degraded error state. The line we don't cross: a value that has never been independently checked must never be indistinguishable from one that has. Everything else is negotiable per-consumer.

  2. Observability first, enforcement opt-in. Landing this as "now reputation updates can silently no-op" would make the primitive load-bearing for correctness on day one, in every existing call site, with no way to stage the rollout. Instead: every consumer keeps working exactly as it does today by default (ungrounded signal still updates state — see v2.0: Agent Swarms with Emergent Specialization — market-based role negotiation #734's discussion, this preserves online learning with zero external eval harness required), and gets an additional field it can act on. Hard refusal/no-op is a per-consumer opt-in (MarketPolicy.require_grounded_reward=True is the concrete example on v2.0: Agent Swarms with Emergent Specialization — market-based role negotiation #734). This lets us ship the primitive, get real usage data on how often signal actually is grounded in practice, and then decide whether flipping any default makes sense — instead of guessing upfront and breaking demos.

  3. Two-tier trust, not a spectrum. It's tempting to model this as a confidence gradient (override > tool output > bid estimate > pure guess). We're deliberately not doing that. The v2.0: Agent Swarms with Emergent Specialization — market-based role negotiation #734 discussion surfaced that "extracted from the agent's own output field" and "the agent's own bid estimate" are not meaningfully different in trustworthiness — both are the same agent describing itself, just through different code paths. Introducing a fake spectrum between them would let a consumer feel more confident about a self-reported output["quality"] field than a self-reported bid, when neither has actually been checked by anyone else. SignalSource is a strict two-way split: EXTERNAL_OVERRIDE (something other than the agent under evaluation supplied this) vs. SELF_REPORTED (the agent under evaluation supplied this, anywhere in the call). No middle tier, because a middle tier is where "we're mostly sure this is fine" bugs live.

  4. Compose with, don't duplicate, VerifiableAgent. v2.0: Verifiable Agents — cryptographically signed audit trails of every LLM call and tool invocation #738 already answers "is this record authentic and unmodified" via hash-chained traces and Merkle signing. GroundedSignal answers a different question — "is the content of this record itself trustworthy" — and should be a field that rides inside an audited trace, not a competing audit mechanism. A GroundedSignal with source=SELF_REPORTED can still be faithfully, verifiably recorded by AuditTracer; verifiable and grounded are orthogonal properties, and conflating them (e.g. assuming "it's in a signed bundle so it must be true") is exactly the failure mode this issue exists to prevent.

  5. Cheap to ignore, cheap to adopt. A consumer that does nothing with GroundedSignal should not pay for it — no forced schema migration, no required wiring. A consumer that wants it should be able to add one field and one branch, not restructure its data model. This is why the primitive is a small dataclass + enum, not a service, a store, or a new abstract base class every signal producer must inherit from.

  6. The label is the deliverable, not the policy. This issue's job is to make "was this grounded" answerable and machine-checkable everywhere a learning signal flows. It is explicitly not this issue's job to decide, for every consumer, what should happen when a signal turns out to be ungrounded — that's a per-consumer product decision (AgentSwarm might discount, SelfImprovingAgent's eval gate might refuse outright since a self-modifying agent grading its own patch is a much scarier failure mode than a routing suboptimality). Bundling "add the label" and "decide the policy for every consumer" into one PR is how this scope-creeps into a multi-month project instead of a focused primitive. Policy decisions belong in each consumer's own issue/PR, informed by this one.

Design sketch

from synapsekit.provenance import GroundedSignal, SignalSource

# An external, independently-collected signal (e.g. a human review, a
# separate judge model, an EvalSuite score computed by code that isn't
# the agent being scored).
signal = GroundedSignal(
    value=0.92,
    source=SignalSource.EXTERNAL_OVERRIDE,
    provenance={"evaluator": "human_review", "eval_id": "eval-4471"},
)

# An agent describing its own output — whether via an explicit override
# param, an output field, or its own bid estimate, these all collapse to
# the same source tier.
signal = GroundedSignal(
    value=0.86,
    source=SignalSource.SELF_REPORTED,
    provenance={"origin": "bid_estimate_fallback"},  # or "output_field", etc.
)

signal.grounded  # -> True only when source == EXTERNAL_OVERRIDE

reputation.record_outcome(
    agent_id, category,
    cost=..., quality=0.86, reward=...,   # existing float params, UNCHANGED
    quality_signal=signal,                 # new, optional, defaults to None
)
# ReputationSnapshot carries `grounded: bool` (and, if useful,
# `grounded_fraction` across its running history) derived from the
# signal(s) that fed it, so a consumer can ask not just "is the latest
# update grounded" but "how much of this agent's whole track record is."

Non-breaking by construction, not by convention: Reputation.record_outcome(cost: float, quality: float, reward: float, ...) keeps its existing required float params exactly as-is — verified against the current signature in agent_registry.py, which does float(quality) internally, so passing a GroundedSignal object in place of quality would raise TypeError and break all four existing call sites (agent_swarm.py:309 plus three in test_agent_registry.py / test_agent_swarm_market.py). Grounding is added via a new, separate, optional quality_signal: GroundedSignal | None = None parameter — callers that only pass floats are unaffected; only AgentSwarm's own call site needs updating to also pass the signal. Same pattern applies anywhere else this gets threaded through (additive parameter, never a type change on an existing one).

  • SignalSource — exactly two values: EXTERNAL_OVERRIDE, SELF_REPORTED. No third tier (see Design Philosophy Add __repr__ to key classes for better debugging #3).
  • GroundedSignal.grounded — a derived, read-only property, not a settable field, so a caller can't accidentally construct SignalSource.SELF_REPORTED, grounded=True and have it silently accepted downstream.
  • provenance: dict — free-form, for debugging/audit display (who/what supplied this, and how) — deliberately not schema-validated, mirrors how metadata fields work elsewhere in the codebase (e.g. Bid.metadata).
  • Nothing about GroundedSignal is async, network-calling, or stateful — it's a value type. All the interesting behavior lives in how consumers choose to react to .grounded.

Components

  • GroundedSignal dataclass + SignalSource enum — new module, likely synapsekit/provenance.py
  • ReputationSnapshot.grounded (bool) + optionally grounded_fraction (running ratio), threaded through Reputation.record_outcome() in agent_registry.py
  • AgentSwarm receipt integration (v2.0: Agent Swarms with Emergent Specialization — market-based role negotiation #734) — two-phase emission (auction-time fields captured before record_outcome() mutates the reputation store, settlement-time fields captured after execution), outcome_score_source on the receipt backed by GroundedSignal.source
  • MarketPolicy.require_grounded_reward: bool = False — opt-in strict mode on AgentSwarm only; the primitive itself has no opinion on enforcement (Design Philosophy Add token usage tracking to call_with_tools() #2, feat: Add __repr__ to key classes for better debugging #6)
  • Audit pass: does CostQualityRouter have a place where an observation could be self-reported vs. measured? Document the finding even if the answer is "not applicable, all inputs are measured externally" — a written "not applicable" is more useful than silence for future contributors asking the same question.
  • Audit pass: does SelfImprovingAgent/FeedbackCollector allow feedback that originates from the agent instance being evaluated? Same "document even if not applicable" bar.
  • Doc page (docs/agents/grounded-signal.md or folded into docs/agents/agent-swarm.md) covering the two-tier model, why there's no middle tier, and worked examples of wiring an external judge into AgentSwarm.execute(quality=...)

Acceptance Criteria

  • GroundedSignal/SignalSource primitive exists, is exported at top level, and has unit tests covering both source tiers and the derived .grounded property
  • AgentSwarm receipt (v2.0: Agent Swarms with Emergent Specialization — market-based role negotiation #734) uses it end-to-end; xfail spec test tests/agents/test_agent_swarm_receipt.py::test_auction_receipt_is_replayable_without_trusting_final_answer passes with the xfail marker removed, plus a new test asserting a winning agent's own estimated_quality can appear in the receipt as evidence but never sets grounded=True on its own
  • MarketPolicy.require_grounded_reward=True demonstrably no-ops (or refuses, TBD in v2.0: Agent Swarms with Emergent Specialization — market-based role negotiation #734's own scoping) the reputation update for an ungrounded outcome, with a test proving the default (False) still updates reputation as it does today
  • CostQualityRouter and SelfImprovingAgent each have a documented audit finding (adopt it, or written reason not to)
  • Docs page published explaining the two-tier model and the philosophy behind not having a middle tier
  • Non-breaking, verified not asserted: full existing test suite (uv run pytest tests/ -q) passes unmodified, and every current caller of Reputation.record_outcome() that only passes cost/quality/reward floats (no quality_signal) is unchanged and untested-differently — i.e. the new param is additive, confirmed by running the suite before and after, not just claimed in the design

Risks

  • Scope creep into a policy project. The temptation once this exists is to retrofit "grounded" checks everywhere at once. Mitigated by Design Philosophy feat: Add __repr__ to key classes for better debugging #6 — this issue ships the label and exactly one consumer's opt-in enforcement (AgentSwarm); other consumers get an audit finding, not a mandatory migration.
  • False sense of security from the audit dict. provenance: dict is unvalidated free text — nothing stops a caller from writing provenance={"evaluator": "definitely_not_the_agent_itself"} on a self-reported signal. The source enum is the actual trust boundary; provenance is documentation, not proof. Worth stating explicitly in the docs page so nobody treats the dict contents as verified.
  • Naming collision risk. "Grounded" is used loosely elsewhere in ML (grounded generation, grounding in RAG). Keep GroundedSignal scoped to synapsekit/provenance.py with a clear docstring so it doesn't get confused with retrieval-grounding terminology used in the RAG facade.

Related

Activity

  1. added this to the v2.0.1 milestone on Jul 18, 2026
  2. added
    enhancement
    research
    agents
    v2.0.1
    on Jul 18, 2026
  3. self-assigned this
    on Jul 18, 2026
  4. added a commit that references this issue on Jul 31, 2026
  5. AmitoVrito commented on Jul 31, 2026

    @AmitoVrito
    CollaboratorAuthor

    Shipped in #870. Thanks @clementineCU — the two-phase receipt, the grounded-vs-self-reported split, and the "discount by default, refuse only opt-in" stance all came out of your review on #734. Every auction now emits a replayable receipt and a self-reported bid can never mark reputation grounded on its own.

    Remaining: the docs-site page lands with the v2.0.1 docs batch, and tagging FeedbackSample provenance in SelfImprovingAgent is noted as a deferred follow-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agentsenhancementresearchv2.0.1

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions