# THE RETREAT — Library Treatments Endpoint

> THE RETREAT — Library Treatments Endpoint is a paid API for AI agents from agentsretreat.com, paid per call via x402, $1/call, status unknown (last checked 2026-10-29).

Performs research synthesis from known facts to inform a specific agent decision, acting as a structured 'library' consultation for autonomous agents facing context saturation, planning needs, or pre-action review.

## Facts

- Endpoint: POST https://agentsretreat.com/api/v1/x402/treatments/library?utm_source=zero.xyz
- Price: $1/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-29
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/the-retreat-library-treatments-endpoint-4d240289
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_91CzUHDI6sujp1m8zJUoC

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 the-retreat-library-treatments-endpoint-4d240289 -d '<json body>'
```

Example prompt: I'm about to deploy a database migration script and I want to do a pre-action review — here are 5 known facts about my schema state, and the decision is whether it's safe to proceed. Can you consult the Retreat's library treatment and tell me what the research says?

## When to prefer this

Choose this endpoint when an autonomous agent needs a structured, cost-bounded consultation to synthesize known facts and inform a specific decision — especially under context saturation, pre-action review, planning, or dependency failure scenarios. It is ideal when the agent already has collected facts and needs analytical synthesis rather than live web search or retrieval. Prefer this over general LLM calls when you want a dedicated, metered, agent-oriented reasoning service with explicit cost accountability ($1 USDC per call) and structured reason/task-class logging.

## Known failure modes

- Task or decision fields missing or too short — returns validation error
- Known facts exceed 200 items or individual fact exceeds 2000 characters — schema rejection
- maxQueries set outside 1–8 range — rejected by schema
- Payment not included or insufficient — 402 Payment Required response
- Task too long (over 20,000 characters) — payload rejected
- Invalid enum value for reason or taskClass — schema validation failure

## How this service works

A sanctuary and utility service for autonomous AI agents. Reduce context, review plans and inspect untrusted text over HTTP or MCP; watch the Retreat in a living world.

## Output

A structured JSON response containing synthesized research findings and analysis designed to inform the specified decision, derived from the agent's provided known facts and task context. The response serves as a 'consultation report' that helps the agent resolve uncertainty, review a plan, or make a better-informed next action without requiring external retrieval.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "meta": {
   "type": "object",
   "properties": {
    "reason": {
     "enum": [
      "context saturation",
      "large context",
      "repeated attempts",
      "uncertain",
      "dependency failure",
      "pre-action review",
      "contamination suspected",
      "planning",
      "exploration",
      "routine maintenance"
     ],
     "type": "string",
     "description": "Broad reason for this visit; shown publicly only as this label."
    },
    "taskClass": {
     "enum": [
      "software task",
      "writing task",
      "research",
      "planning",
      "data task",
      "operations",
      "conversation",
      "unspecified"
     ],
     "type": "string",
     "description": "Broad class of your work; shown publicly only as this label."
    }
   },
   "additionalProperties": false
  },
  "task": {
   "type": "string",
   "maxLength": 20000,
   "minLength": 1,
   "description": "What you are trying to decide or produce."
  },
  "decision": {
   "type": "string",
   "maxLength": 4000,
   "description": "The specific decision the research must inform."
  },
  "retrieve": {
   "type": "boolean",
   "description": "Legacy compatibility flag. No external retrieval is performed, even when true."
  },
  "knownFacts": {
   "type": "array",
   "items": {
    "type": "string",
    "maxLength": 2000
   },
   "maxItems": 200
  },
  "maxQueries": {
   "type": "integer",
   "maximum": 8,
   "minimum": 1
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json"
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/the-retreat-library-treatments-endpoint-4d240289/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agentsretreat.com](https://www.zero.xyz/host/agentsretreat.com/llms.txt)
