Agent-receipts is an open-source tool that provides a structured audit trail for AI agents. It captures key elements like sources, risks, and confidence scores, ensuring that AI decisions are transparent and defensible, especially in regulated industries. This promotes trust and compliance while facilitating effective human oversight. Give it a star!!!
Built by a 17y/o dev,
AI Receipt Ledger: A comprehensive solution for creating structured audit trails for AI agent sessions. This open-source tool enhances transparency in AI operations by transforming complex AI responses into auditable receipts. It allows for detailed documentation of sources, risks, confidence levels, and review notes, making it an invaluable resource in scenarios where the cost of errors is significant.
Key Features
- Human-in-the-Loop: Provides reviewers with essential evidence, including sources, assumptions, and checklists, ensuring accountability in decision-making.
- Compliance: Facilitates the creation of a defensible record of reasoning for industries that require strict compliance, such as legal, finance, and medical sectors.
- Debugging: Captures tool calls and flags potential risks in real-time, enabling proactive identification of inaccuracies within AI responses.
- Trust: Displays a Confidence Score alongside verified sources, enhancing user confidence that the AI system is grounded in reliable information rather than guesswork.
Usage Examples
Using AI Receipt Ledger is straightforward, with minimal configuration required:
Quick Receipt Generation
Automatically generate receipts for AI responses with high compatibility using the quickReceipt function:
import { quickReceipt, exportReceiptToMarkdown } from "agent-receipts";
// Wrap your AI call directly with quickReceipt.
const { answer, receipt } = await quickReceipt(task, openai.chat.completions.create({ ... }));
// Export the receipt as a "Mini Slip".
console.log(exportReceiptToMarkdown(receipt));
Full Integration Control
For more granular control, integrate with the attachReceiptToResponse helper:
import { attachReceiptToResponse } from "agent-receipts";
const { answer, receipt } = await attachReceiptToResponse(task, async () => {
const res = await openai.chat.completions.create({ ... });
return {
text: res.choices[0].message.content,
model: "gpt-4o",
confidenceScore: 95,
sources: [{ title: "My PDF", url: "..." }],
};
});
Exporting Receipts
Generate variations of receipt formats for different use cases:
// Export a Compact "Mini Slip" for quick sharing.
const mini = exportReceiptToMarkdown(receipt, { mode: "mini" });
// Create a Detailed Audit Log for comprehensive reporting.
const full = exportReceiptToMarkdown(receipt, { mode: "full" });
Project Structure
src/core: Core Receipt engine (Types, Validation, Export)src/react: Drop-in components and hooks for UI integrationexamples/: Guides for various integrations including Node, React, and Next.js
By utilizing this project, AI developers can significantly enhance the reliability and traceability of their AI processes.
No comments yet.
Sign in to be the first to comment.