feat(agents): Agent Layer v0 — agent-action ingestion backend#190
Open
saltyskip wants to merge 2 commits into
Open
feat(agents): Agent Layer v0 — agent-action ingestion backend#190saltyskip wants to merge 2 commits into
saltyskip wants to merge 2 commits into
Conversation
The measurement landing zone for the Agent Layer (see
docs/agent-layer-spec.md): a drop-in MCP SDK will POST one event per
instrumented tool call to a new ingest endpoint, which Rift attributes
across agents. This commit ships the backend half.
- services/agents/: AgentActionEvent time-series store + record_action
service (quota via TrackEvent → mint journey token → persist)
- POST /v1/agents/actions ingest (rl_live_/x402 auth, 402 on quota)
- AgentActionId (aae_) + JourneyToken (rj_) public-id types
- AppState/main.rs wiring + OpenAPI ("Agents" tag)
Backend only; the riftl-mcp SDK crate + RiftMcp dogfood land next.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The sensor half of the Agent Layer: a standalone, drop-in crate that instruments any rmcp ServerHandler and ships every tool call to Rift's POST /v1/agents/actions ingest. client/mcp-rust/ (riftl-mcp): - Instrumented<H>: ServerHandler decorator wrapping the call_tool chokepoint; delegates get_info/initialize/list_tools/get_tool unchanged - fail-open async emit (tokio::spawn) — never blocks or fails the tool call - ActionEmitter trait + default HttpEmitter; .instrument(config) one-liner - wire-contract test locking AgentAction JSON to the server's RecordActionRequest - compiles unchanged against rmcp 1.2 and 1.7 server: - optional, mcp-feature-gated path dependency on riftl-mcp - mcp_router wraps RiftMcp via .instrument(...) when RIFT_AGENT_INGEST_URL + RIFT_AGENT_KEY are set (opt-in dogfood; off by default) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner
Author
|
Update: the riftl-mcp SDK crate + RiftMcp dogfood wiring landed in this PR (commit 3ebd028), not a follow-up — it kept the slice coherent and the type-level dogfood ( |
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.
What
First slice of the Agent Layer — Rift's measurement + (future) controlled-handoff layer for instrumented MCP servers. Full design in
docs/agent-layer-spec.md.This PR is the backend landing zone: the place a drop-in MCP SDK posts one event per instrumented tool call, which Rift stores and (in later PRs) attributes across agents and through the web→app handoff.
Changes
services/agents/— new domain:AgentActionEventtime-series store (agent_action_events, retention TTL, mirrors conversions/clicks) +record_actionservice (quota → mint journey token → persist).POST /v1/agents/actions— ingest endpoint,rl_live_/x402 authed,402on quota. Quota enforced in the service layer per the transport rules.AgentActionId(aae_) andJourneyToken(rj_).AppState+main.rsrepo tuple, OpenAPI path/schemas + "Agents" tag.Scope / non-goals
Backend only. Reuses the existing
Resource::TrackEventquota meter for v0 (split later when pricing is decided). Theriftl-mcpRust SDK crate (theInstrumented<ServerHandler>wrapper) + routing Rift's ownRiftMcpthrough it (dogfood) land in the next PR.Checks
cargo fmt --check✅ ·cargo clippy -D warnings✅ ·cargo test✅ (556 tests)🤖 Generated with Claude Code