{"uid":"cap_7vCPmKsXuaMl3K1KJF5Jq","slug":"agentdiet-rag-diet-context-guard-a2a-token-compression-endpoint-3a6ea278","name":"AgentDiet RAG-Diet Context Guard — A2A Token Compression Endpoint","description":"Deterministic B2A/A2A/MCP/x402/MPP/L402 execution and intelligence node at https://rag-diet.agentdiet.dev settling in USDC on Base.","url":"https://rag-diet.agentdiet.dev/v1/guard?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET","POST"],"type":"string"},"queryParams":{"type":"object","properties":{"text":{"type":"string"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object"}}}}},"responseSchema":{"type":"json","example":{"data":{},"status":"ok","roi_proof":{"compression_ratio_pct":91.4}}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.005","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.005/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_eNdGCEFz76Horxdtf-XPU","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.005","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Compresses and distills text input by up to 91% to reduce AI context window token usage, returning a compacted representation with a compression ratio proof.","exampleAgentPrompt":"Can you run this block of text through AgentDiet's RAG-Diet guard to compress it and tell me the token reduction ratio I'm getting? Here's the text: 'The quarterly earnings report showed a 12% increase in revenue driven primarily by enterprise subscription growth across the APAC and EMEA regions, with operating margins expanding by 200 basis points year-over-year.'","exampleUseCases":[{"title":"Shrinking RAG chunks before LLM injection","prompt":"I'm stuffing too many retrieved chunks into my agent's context and hitting token limits — can you compress this retrieved document text through RAG-Diet and show me how much smaller it gets? Text: 'The European Central Bank announced its decision to hold interest rates steady at 4.5% citing persistent inflation in the services sector and uncertainty around global trade conditions, while acknowledging that growth projections for the eurozone have been revised downward for the second consecutive quarter.'"},{"title":"LLM API cost reduction for long prompts","prompt":"My GPT-4 calls are getting expensive because my system prompts are huge. Run this system prompt text through AgentDiet's context distiller so I can see the compression ratio and use the slimmed-down version instead: 'You are a highly capable enterprise assistant specialized in financial analysis, regulatory compliance, and cross-border trade law, with deep expertise in SEC filings, GAAP accounting standards, Basel III capital requirements, and WTO dispute resolution mechanisms...'"},{"title":"Pre-processing agent memory before context injection","prompt":"Before I inject this agent memory summary into the next turn's context, compress it through RAG-Diet's guard endpoint to cut the token load — here's the memory blob: 'User previously discussed project milestones, budget constraints of $250k, preferred vendors including Accenture and Deloitte, a hard deadline of Q3 2025, and concerns about regulatory approval timelines in the EU market.'"}],"resultDescription":"Returns a JSON object with a 'status' field ('ok'), a 'data' field containing the distilled/compressed output, and an 'roi_proof' object with a 'compression_ratio_pct' value (e.g. 91.4) indicating how much the input was reduced. Payment of $0.005 USDC on Base is settled via x402/L402 before the response is served.","failureModes":["Missing or empty 'text' query parameter returns an error or empty compression result","Payment not settled in USDC on Base results in 402 Payment Required response","Invalid 'method' enum value (not GET or POST) causes schema validation failure","Text input too large for single-call processing may result in timeout or truncation","Non-HTTP 'type' value in input object causes request rejection due to const constraint"],"whenToPreferThis":"Choose this endpoint when you need deterministic, cheap ($0.005/call), measurable token compression with an ROI proof — particularly for RAG pipelines where retrieved chunks need to be slimmed before LLM injection, or for agent workflows hitting context window limits. Prefer this over generic summarization when you need a quantifiable compression ratio and deterministic (not generative) reduction. Best suited for A2A and MCP pipelines that can handle x402/L402 micropayment settlement in USDC on Base.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-22T12:43:45.903Z","isFirstParty":false,"canonicalSlug":"agentdiet-rag-diet-context-guard-a2a-token-compression-endpoint-3a6ea278"}