Reintroduce sink interceptor type for context-reactive workflows#1
Open
PederHP wants to merge 1 commit into
Open
Reintroduce sink interceptor type for context-reactive workflows#1PederHP wants to merge 1 commit into
PederHP wants to merge 1 commit into
Conversation
Adds a third interceptor type, `sink`, for non-blocking, non-mutating interceptors that react to context to drive concurrent UX, workflow state, or downstream pipelines (avatar animation, voice-mode triggers, real-time UI affordances, background indexing) without affecting the request/response interaction. This is additive to the validator/mutator split and `mode: "audit"` introduced in this SEP. Audit mode disables enforcement while preserving the validator/mutator interface; sinks are structurally non-enforcing and cannot be promoted to affect the interaction. The Rationale section now covers why these are separate concepts. Renaming from the original draft's `observability` to `sink` to avoid the implication of overlap with OpenTelemetry / general logging tooling. A callout block in the Sink section makes this distinction explicit. Changes: - Type union extended to "validation" | "mutation" | "sink" (3 sites) - New Sink section parallel to Validator / Mutator with use cases and SinkResult - Execution model: Sink as third stage (parallel, fire-and-forget) on each phase - Type Behaviors table updated; sinks MUST NOT use `mode: "audit"` - audit-logger example reframed as sink; new avatar-mood sink example added - Rationale section restructured (Separation of three types, Why Sink vs audit, Why "Sink" and Not "Observability") The C# experimental reference implementation (modelcontextprotocol/experimental-ext-interceptors) tracks this and demonstrates the avatar use case end-to-end in AvatarMoodInterceptorSample. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Author
|
@Degiorgio Made this PR for reintroduction of non-blocking, non-mutating interceptors to the SEP. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a third interceptor type,
sink, for non-blocking, non-mutating interceptors that react to context to drive concurrent UX, workflow state, or downstream pipelines (avatar animation, voice-mode triggers, real-time UI affordances, background indexing) without affecting the request/response interaction.This is additive to the validator/mutator split and
mode: \"audit\"you introduced — both are preserved unchanged. The PR slotssinkin as a structurally non-enforcing third type, distinct from audit-mode validators/mutators.Why
There's a real class of agentic-UX interceptor that doesn't fit validators or mutators:
AvatarMoodInterceptorSample)These aren't silently-observing guardrails. They are first-class workflows that just happen to live outside the request/response trust boundary.
mode: \"audit\"doesn't quite cover this:valid,severity,messages) — not a meaningful interface for an avatar driverA separate type makes the intent legible at the boundary. The PR codifies this with a MUST-reject on
mode: \"audit\"for sinks.Naming
The original draft used
observabilityfor this third type. I think it was right to drop that name — it implies overlap with OpenTelemetry and general logging infrastructure, which sinks are not. Renamed tosink(drains/absorbs the payload, prior art in OTel exporters and log sinks without semantic collision). A callout in the Sink section makes the distinction from OTel explicit, since that was the original concern.Open to bikeshed; happy to change before merging.
Changes
\"validation\" | \"mutation\" | \"sink\"(3 sites:Interceptor,ChainEntry,ChainExecutionResult.results)#### Sinksection parallel to Validator / Mutator with use cases,SinkResultinterface, and distinction callouts (vs OTel, vsmode: \"audit\")Mutate → Validate → Sink → SendandValidate → Sink → Mutate → Processmode: \"audit\"audit-loggerexample ininterceptors/listreframed astype: \"sink\"; newavatar-moodsink example added to anchor the UX-driver framingDeliberately not touched (candidates for a follow-up if you want):
Reference implementation
The C# experimental reference implementation tracks SEP-2624 and includes
sinkas proposed here: https://github.com/modelcontextprotocol/experimental-ext-interceptors. TheAvatarMoodInterceptorSampledemonstrates the avatar-mood use case end-to-end.Test plan
🤖 Generated with Claude Code