Trace Google GenAI with Future AGI
Integrate Google GenAI with Future AGI observability. Set up traceAI-google-genai to capture model calls and monitor performance automatically.
Trace Google GenAI model calls in Future AGI.
1. Install
Use Python 3.10–3.13 and install the instrumentation and Google Gen AI SDK.
pip install traceAI-google-genai google-genai
2. Configure credentials and content capture
Set credentials in the shell that runs your application:
export FI_API_KEY="your-futureagi-api-key"
export FI_SECRET_KEY="your-futureagi-secret-key"
The instrumentor captures request and response data by default, including message content and available model configuration. Before initializing tracing, set FI_HIDE_INPUTS=true and FI_HIDE_OUTPUTS=true to redact input/output values and messages. Model configuration and tool-schema attributes need separate review; these switches are not a blanket filter for custom attributes. See mask span attributes for the field-specific controls.
3. Initialize tracing
Add the Python blocks below, in order, to the same script. Register the Observe project before making a model request.
from fi_instrumentation import register
from fi_instrumentation.fi_types import ProjectType
trace_provider = register(
project_type=ProjectType.OBSERVE,
project_name="google_genai",
)
4. Instrument Google GenAI
from traceai_google_genai import GoogleGenAIInstrumentor
GoogleGenAIInstrumentor().instrument(tracer_provider=trace_provider)
5. Run a Google GenAI request
This example uses Vertex AI. Set up Application Default Credentials for a Google Cloud project with billing and the Vertex AI API enabled, then replace your_project_name with that project’s ID.
from google import genai
from google.genai import types
client = genai.Client(vertexai=True, project="your_project_name", location="global")
content = types.Content(
role="user",
parts=[
types.Part.from_text(text="Hello how are you?"),
],
)
response = client.models.generate_content(
model="gemini-3.8-flash", contents=content
)
print(response)
trace_provider.force_flush()
trace_provider.shutdown()
Flush before a short script exits so queued spans can be sent. Open Observe in Future AGI, select the google_genai project and inspect the model-call span.
Questions & Discussion