Skip to main content

Quickstart

This guide will get you from zero to traced AI calls in under 5 minutes.

Prerequisites

  • A Foil account (sign up here)
  • An API key from the Foil dashboard
  • Node.js 18+ or Python 3.8+
The fastest way to integrate. The Foil Wizard is an AI agent that scans your codebase and automatically adds Foil instrumentation.
The wizard edits your source files. We recommend running it on a separate branch.
The wizard will install the SDK, identify your LLM calls and agent patterns, and add tracing automatically. Review the changes, test, and merge when you’re happy.

Wizard Documentation

Full guide on what the wizard instruments, troubleshooting, and rate limits

Option B: Manual Integration

Prefer to wire things up yourself? Follow the steps below.

Step 1: Install the SDK

Step 2: Initialize Foil

The primary SDK — works with any LLM provider and gives you nested span trees.

Step 3: Trace Your First Call

Use foil.trace() and ctx.llmCall() for full control over your span tree.

Step 4: View Your Trace

  1. Go to the Foil Dashboard
  2. Navigate to Traces
  3. Click on your trace to see the full span details
You’ll see:
  • The input and output of your LLM call
  • Token usage breakdown
  • Latency metrics
  • Any errors or warnings

What’s Next?

Foil Wizard

AI-powered automatic instrumentation

JavaScript SDK

Nested spans, tools, signals, and feedback

Auto-Instrumentation

Zero-code tracing for supported providers

Set Up Alerts

Get notified when issues occur

Record Feedback

Capture user feedback on your AI outputs
More examples: Browse complete, runnable examples at github.com/getfoil/foil-examples — including auto-instrumentation, custom evaluations, semantic search, and real-world agent scenarios.

Complete Example

Here’s a full working example with an agentic tool-calling loop — the LLM decides which tools to call:
This produces a span tree like:
Run it: