1. Installation
Install the traceAI and Google GenAI packages.
pip install traceAI-google-genai
2. Set Environment Variables
Set up your environment variables to authenticate with FutureAGI.
import os
os.environ["FI_API_KEY"] = "your-futureagi-api-key"
os.environ["FI_SECRET_KEY"] = "your-futureagi-secret-key"
3. Initialize Trace Provider
Set up the trace provider to create a new project in FutureAGI, establish telemetry data pipelines .
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 your Project
Instrument your project to enable automatic tracing.
from traceai_google_genai import GoogleGenAIInstrumentor
GoogleGenAIInstrumentor().instrument(tracer_provider=trace_provider)
5. Interact with Google ADK
Start interacting with Google ADK as you normally would. Our Instrumentor will automatically trace and send the telemetry data to our platform. Here is a sample code using the Google ADK SDK.
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-2.0-flash-001", contents=content
)
print(response)