Skip to main content

Python SDK

The FutureAGI Python SDK provides a simple, DataFrame-based interface for logging annotations against your traces. Install the package, authenticate, and start annotating in minutes.

Installation

Authentication

You can also set FI_API_KEY and FI_SECRET_KEY as environment variables. The client picks them up automatically when no arguments are passed.

Log Annotations

The log_annotations() method accepts a pandas DataFrame where each row represents one annotation record. Columns follow the naming convention annotation.<label_name>.<type>.

Column naming convention

Every row must include a context.span_id column. This links the annotation to a specific span in your Observe project.

Full example

Response object


Get Labels

Retrieve all annotation labels configured for a project. Use the returned label IDs when constructing your DataFrame columns.

List Projects

List all projects accessible to your API key. Filter by project type to find your Observe projects.

Annotation Queues

For queue management — creating queues, adding items, submitting annotations, and exporting results — use the REST API directly or the JavaScript SDK which provides full queue support. See the Queues API reference for details.

Best Practices

  • Batch annotations — Group 100—500 records per DataFrame for optimal throughput.
  • Consistent span IDs — Ensure span IDs match traces in your Observe project. Invalid IDs result in per-row errors.
  • Idempotent notes — Duplicate notes for the same span are silently skipped.
  • Error handling — Always check response.errors_count and inspect response.errors for partial failures.
  • Label IDs — Use get_labels() to fetch label names and IDs before constructing your DataFrame.
Annotations are immutable once submitted. Double-check your DataFrame before calling log_annotations().

Next steps

JavaScript SDK

Full queue management, scores, and annotation support in JavaScript/TypeScript.

Scores API

Query and manage annotation scores via the REST API.

Bulk Annotation API

Upload annotations in bulk using the REST API directly.