import os
import trulayer
from crewai import Agent, Crew, Task
from trulayer.instruments.crewai import instrument_crewai
trulayer.init(api_key=os.environ["TRULAYER_API_KEY"], project_name="my-app")
researcher = Agent(
role="Researcher",
goal="Find the capital of France.",
backstory="You are a methodical researcher.",
)
task = Task(description="Answer the user's question.", agent=researcher, expected_output="A one-line answer.")
crew = Crew(agents=[researcher], tasks=[task])
with trulayer.trace("crew-run") as trace:
instrument_crewai(crew, trace)
result = crew.kickoff(inputs={"question": "What is the capital of France?"})