# AgentDiet RAG-Diet Context Guard — A2A Token Compression Endpoint

> AgentDiet RAG-Diet Context Guard — A2A Token Compression Endpoint is a paid API for AI agents from rag-diet.agentdiet.dev, paid per call via x402, $0.005/call, status unknown (last checked 2026-10-22).

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.

## Facts

- Endpoint: GET https://rag-diet.agentdiet.dev/v1/guard?utm_source=zero.xyz
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-22
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agentdiet-rag-diet-context-guard-a2a-token-compression-endpoint-3a6ea278
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_7vCPmKsXuaMl3K1KJF5Jq

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability agentdiet-rag-diet-context-guard-a2a-token-compression-endpoint-3a6ea278
```

Example prompt: 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.'

## When to prefer this

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.

## Known failure modes

- 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

## How this service works

Deterministic B2A/A2A/MCP/x402/MPP/L402 execution and intelligence node at https://rag-diet.agentdiet.dev settling in USDC on Base.

## Output

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.

## Request schema (JSON Schema)

```json
{
 "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"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "data": {},
  "status": "ok",
  "roi_proof": {
   "compression_ratio_pct": 91.4
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agentdiet-rag-diet-context-guard-a2a-token-compression-endpoint-3a6ea278/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from rag-diet.agentdiet.dev](https://www.zero.xyz/host/rag-diet.agentdiet.dev/llms.txt)
