Skip to main content

SDK Overview

Foil provides official SDKs for JavaScript and Python. Both SDKs offer core functionality for tracing, logging, and feedback collection, with the JavaScript SDK providing additional features for complex agent workflows.

Feature Comparison

Examples: Browse complete, runnable examples for both SDKs at github.com/getfoil/foil-examples.

JavaScript SDK

The JavaScript SDK is our most full-featured SDK, designed for complex AI applications with multiple agents, tools, and nested workflows. Best for:
  • Node.js backend services
  • Next.js applications
  • Complex agent architectures
  • Vercel AI integration

JavaScript SDK Docs

Complete JavaScript SDK documentation

Key Features

Foil - High-level tracing API with automatic span management:
Framework Integrations:

Python SDK

The Python SDK provides tracing, logging, and feedback collection for Python applications, with automatic OpenAI instrumentation. Best for:
  • Python backend services
  • FastAPI/Flask applications
  • Jupyter notebooks
  • LLM integrations

Python SDK Docs

Complete Python SDK documentation

Key Features

Foil - High-level tracing API with automatic span management:
OpenAI Wrapper - Automatic tracing for all OpenAI calls:

Authentication

Both SDKs use API key authentication. Get your API key from the Foil Dashboard.
Never commit API keys to version control. Use environment variables or a secrets manager.

Debug Mode

Enable debug logging to troubleshoot integration issues: