SKILL.md--- name: failproofai-sdk description: |- Make a custom AI agent — Python or TypeScript/JavaScript, on a framework or hand-built — report what it did to Failproof AI, and run your own evaluator worker (the "eval pod") that scores those runs. Reach for it on vague phrasing too: "add observability to my agent", "why isn't my agent showing up?", "run an LLM judge on our own infra". Trigger when the user wants to: • plan an integration — which points in the agent loop to record; • instrument — add `failproofai-sdk` (Python) or `@failproofai/sdk` (Node, Bun, Deno, Next.js): turn on an adapter (LangChain/LangGraph, CrewAI, LlamaIndex, Pydantic AI, Vercel AI SDK, Mastra) or wire a hand-built loop; • verify — confirm events are written, or debug an integration that produces nothing; • evaluate — write, deploy or debug an Evaluator worker in Python or TypeScript. NOT for reading telemetry or scores that already landed (that's `fp-cloud-cli`), or deciding what is worth evaluating (that's `failproofai-eval-brainstorm`). --- # Failproof AI SDK — Python and TypeScript Two packages, one pipe: `failproofai-sdk` (Python, imported as `failproofai_sdk`) and `@failproofai/sdk` (TypeScript/JavaScript). They write the same 16 events in the same wire format into the same spool directory. Everything in this file is language-neutral unless it says otherwise, and code blocks are Python. **For a TypeScript or JavaScript agent, read `references/typescript.md` alongside it**: it has the camelCase names, the adapters, bundler and Next.js setup, the no-framework wiring, shutdown and verification. Both packages also ship the **evaluator worker** that scores finished sessions on your own infrastructure (§7, `references/evaluator.md`). The SDK records what your agent did, from inside your agent. You call it at points you choose; it appends structured events to local `.jsonl` files. A separate collector ships those files to the platform. ``` your agent calls failproofai_sdk.event.* → SDK queues it in memory → flush thread writes <base_dir>/events/event-<timestamp>.jsonl → collector picks the file up and ships it → visible as sessions / events / errors / evals ``` **The SDK's job ends at the file.** That boundary is the most useful thing to know about it: everything up to the `.jsonl` is yours to get right and yours to verify, and it is verifiable on a laptop with no server, no API key, and no network. The API is small — 16 event methods, all keyword-only except `self_report`'s two leading arguments. The hard parts are **deciding where to call them** and **knowing which silences are bugs**, because this SDK does not raise when you get it wrong. Sections 1-3 are the plan, 4 is the code, 5-6 are the proof, 7 is scoring the runs. ## 1. Install it TypeScript/JavaScript: `npm install @failproofai/sdk` — zero dependencies, Node ≥ 20.9, Bun or Deno, ESM and CommonJS. The npm name has no lo