Overview
This guide walks through a complete RAG (Retrieval-Augmented Generation) pipeline using only HTTP requests to the Artanis REST API. You’ll see how to:- Create a trace
- Record input observations
- Capture state for replay
- Record output observations
- Complete the trace
- Submit user feedback
Full Example: RAG Pipeline
Flow Diagram
Here’s the sequence of API calls in this example:Key Concepts Demonstrated
1. Client-Side Trace ID Generation
The trace ID is generated client-side before any API calls. This enables the fire-and-forget pattern with no server round-trips.2. Immediate Observation Sending
Observations are sent immediately as they occur, not batched. This ensures data is captured even if the application crashes.3. State Capture for Replay
The example captures three types of state:- documents: The document corpus at query time
- retrieved_chunks: Which documents were retrieved and their scores
- config: Generation parameters and prompt template
4. Progressive Input Recording
Inputs are recorded at multiple stages:- Initial user query
- Generation parameters added later
5. Consistent Metadata
The same metadata is used in both the “create” and “complete” trace requests, ensuring consistency.Error Handling
Add error handling to production code:Next Steps
SDK Quick Start
Use official SDKs for automatic request handling
Traces Endpoint
Detailed trace endpoint documentation
Observations Endpoint
Detailed observations endpoint documentation
Feedback Endpoint
Detailed feedback endpoint documentation
Comparison: REST API vs SDK
| Feature | REST API | Official SDK |
|---|---|---|
| Setup | No installation, any HTTP client | npm/pip install |
| Code | Manual HTTP requests | Simple method calls |
| Trace ID | Manual generation required | Automatic generation |
| Error Handling | Manual retry logic | Built-in silent failures |
| Overhead | Network latency per request | <0.1ms per operation |
| Type Safety | JSON validation at runtime | Compile-time type checking |
| Best For | Languages without SDKs | Python & TypeScript projects |
The REST API is perfect for Haskell, Go, Rust, and other languages without official SDKs. The official SDKs provide a better developer experience when available.