Python sdk
Getting Started

Getting started

pip install agiflow-sdk

Sdk overview

agiflow-sdk provides below functionalities:

  • Automatic tracing with Open Telemetry.
  • Decorators for manual tracing.
  • Helpers to interact with backend APIs.

Setup sdk

Setup agiflow-sdk client once at the entry of your application:

from agiflow import Agiflow
 
Agiflow.init(
  app_name="<YOUR_APP_NAME>",
  api_key="<AGIFLOW_API_KEY>" # Or set AGIFLOW_API_KEY environment variable
)

The api key is available on Environment > Settings > Api Key page on Agiflow Dashboard (opens in a new tab).

That's it, if you run your backend application with supported LLM frameworks, traces should be logged on Agiflow dashboard on Environment > Logs.

Environment variables

AGIFLOW_BASE_URL: If you use Agiflow docker-compose for local dev or self-host, set base-url to your selfhosted endpoint. AGIFLOW_API_KEY: Switch api key per environment.

ℹ️

AGIFlow use separated global Open Telemetry trace provider to ensure all LLM traces are sent to support user feedback. To use default Open Telemetry global trace provider, set AGIFLOW_OTEL_PYTHON_TRACER_PROVIDER_GLOBAL environment variable to true.