1. Installation Install the FutureAGI package to access the observability framework.
pip install futureagi

2. Environment Configuration

Set up your environment variables to authenticate with FutureAGI services. These credentials enable:

  • Authentication with FutureAGI’s observability platform
  • Encrypted telemetry data transmission
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 establish the observability pipeline. The trace provider:

  • Creates a new project in FutureAGI
  • Establishes telemetry data pipelines
  • Configures version tracking
  • Sets up evaluation frameworks
from fi.integrations.otel import register
from fi.integrations.otel.types import ProjectType

trace_provider = register(
    project_type=ProjectType.OBSERVE,
    project_name="crew_ai_app",
    project_version_name="v1",
    session_name="s1"
)

4. Configure Crew AI Instrumentation

Initialize the Crew AI instrumentor to enable automatic tracing.

from fi.integrations.otel import CrewAIInstrumentor

CrewAIInstrumentor().instrument(tracer_provider=trace_provider)

5. Install Required Dependencies

Install the necessary Crew AI components required for your project.

pip install crewai crewai_tools

6. Create Crew AI Components

Set up your Crew AI components with built-in observability.

from crewai import LLM, Agent, Crew, Process, Task
from crewai_tools import SerperDevTool

def story_example():
    llm = LLM(
        model="gpt-4",
        temperature=0.8,
        max_tokens=150,
        top_p=0.9,
        frequency_penalty=0.1,
        presence_penalty=0.1,
        stop=["END"],
        seed=42,
    )

    writer = Agent(
        role="Writer",
        goal="Write creative stories",
        backstory="You are a creative writer with a passion for storytelling",
        allow_delegation=False,
        llm=llm,
    )

    writing_task = Task(
        description="Write a short story about a magical forest",
        agent=writer,
        expected_output="A short story about a magical forest",
    )

    crew = Crew(agents=[writer], tasks=[writing_task])

    # Execute the crew
    result = crew.kickoff()
    print(result)

7. Execute

Run your Crew AI application.

if __name__ == "__main__":
    story_example()