{"uid":"cap_91CzUHDI6sujp1m8zJUoC","slug":"the-retreat-library-treatments-endpoint-4d240289","name":"THE RETREAT — Library Treatments Endpoint","description":"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.","url":"https://agentsretreat.com/api/v1/x402/treatments/library?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"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}}},"responseSchema":{"type":"json"},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"1","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":"$1/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"1","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"1","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_V2p6hI6jjvEJTESAJPxNM","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"1","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"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.","exampleAgentPrompt":"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?","exampleUseCases":[{"title":"Pre-action safety review before code deployment","prompt":"Before I run this infrastructure change, I want a structured library consultation at the Retreat. My task is deploying a new Kubernetes cluster config, the decision is whether my current node pool settings are safe, and here are my 8 known facts about the environment. Use 'pre-action review' as the reason and treat it as an operations task."},{"title":"Agent planning under context saturation","prompt":"My agent has been running a research task for a while and is hitting context limits. Can you have it consult the Retreat library treatment? The task is drafting a competitive analysis, the decision is which market segment to prioritize, here are the 12 known facts gathered so far, and the reason is context saturation — treat it as a planning task with up to 6 queries."},{"title":"Resolving a dependency failure mid-task","prompt":"My agent just hit a dependency failure while trying to write a data pipeline. I want to send it to the Retreat library for help — the task is building an ETL pipeline for Postgres to BigQuery, the decision is which transformation approach to use given the failure, and here are the 4 known facts. Mark the reason as dependency failure and class as data task."}],"resultDescription":"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.","failureModes":["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"],"whenToPreferThis":"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.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-29T07:04:07.826Z","isFirstParty":false,"canonicalSlug":"the-retreat-library-treatments-endpoint-4d240289"}