Quickstart
Add evaluation to your AI app in under ten minutes. This Python and OpenAI example follows the same pattern across supported providers.
1. Install the SDK
pip install futureagi
Python 3.9 or later is required. Beyond your existing LLM provider SDK, no dependencies are needed.
2. Wrap your client
Replace your provider import with the Future AGI wrapper. All other code stays the same.
# Before
from openai import OpenAI
client = OpenAI(api_key="sk-...")
# After: swap the import, add your Future AGI key
from futureagi import FutureAGI
client = FutureAGI(
openai_api_key="sk-...",
futureagi_api_key="fagi-..."
)
Find your Future AGI API key in dashboard Settings. Or set FUTUREAGI_API_KEY as an environment variable and leave it out of the constructor.
3. Add a rubric to your call
Include a rubric parameter in any chat completion call. It tells Future AGI what qualifies as a good response.
response = client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Summarize this contract in plain language."}
],
rubric={
"criteria": "Factual, uses plain language, does not include legal jargon, under 5 sentences",
"threshold": 0.8
}
)
Set the minimum passing score with threshold (0 to 1). Calls scoring below it appear as dashboard flags and may trigger alerts.
4. Open dashboard traces
After one instrumented call, visit the Future AGI dashboard at gofutureagi.org and select Traces. You will see:
- Each call's complete prompt and response
- The rubric score (0-100) plus passed or failed criteria
- Latency, tokens, and model metadata
- Timeline view of multi-hop agent traces
LangChain integration
For LangChain, use the Future AGI callback handler, not a client wrapper. Add it to any chain or agent.
from langchain_openai import ChatOpenAI
from futureagi.integrations.langchain import FutureAGICallbackHandler
handler = FutureAGICallbackHandler(api_key="fagi-...")
llm = ChatOpenAI(model="gpt-4o", callbacks=[handler])
# All chains using this LLM are automatically traced
result = llm.invoke("What is the capital of France?")
LlamaIndex integration
With LlamaIndex, Future AGI observer uses LlamaIndex's built-in instrumentation hooks.
from llama_index.core import Settings
from futureagi.integrations.llamaindex import FutureAGIInstrumentation
fi = FutureAGIInstrumentation(api_key="fagi-...")
fi.register() # hooks into global LlamaIndex instrumentation
# All subsequent LlamaIndex queries are traced
REST API reference
SDK actions use the REST API. Base URL: https://api.gofutureagi.org/v1. Send your key in the Authorization: Bearer header.
POST /traces
Submit a trace without the SDK. This suits environments lacking the Python or Node SDK.
{
"trace_id": "your-uuid",
"model": "gpt-4o",
"prompt": "...",
"response": "...",
"rubric": { "criteria": "...", "threshold": 0.8 },
"latency_ms": 340
}
GET /traces
Lists authenticated-account traces with pagination. Supports project_id, start, end, and below_threshold query parameters.