Datadog LLM Observability helps AI engineers, data scientists, and application developers quickly develop, evaluate, and monitor LLM applications. Confidently improve output quality, performance, costs, and overall risk with structured experiments, end-to-end tracing across AI agents, and evaluations.
If you do not have a Datadog API key, you can create an account and get your API key.You will also need to specify an ML Application name in the following environment variables. An ML Application is a grouping of LLM Observability traces associated with a specific LLM-based application. See ML Application Naming Guidelines for more information on limitations with ML Application names.
# crewai_agent.pyfrom crewai import Agent, Task, Crewfrom crewai_tools import ( WebsiteSearchTool)web_rag_tool = WebsiteSearchTool()writer = Agent( role="Writer", goal="You make math engaging and understandable for young children through poetry", backstory="You're an expert in writing haikus but you know nothing of math.", tools=[web_rag_tool],)task = Task( description=("What is {multiplication}?"), expected_output=("Compose a haiku that includes the answer."), agent=writer)crew = Crew( agents=[writer], tasks=[task], share_crew=False)output = crew.kickoff(dict(multiplication="2 * 2"))
After running the application, you can view the traces in Datadog LLM Observability’s Traces View, selecting the ML Application name you chose from the top-left dropdown.Clicking on a trace will show you the details of the trace, including total tokens used, number of LLM calls, models used, and estimated cost. Clicking into a specific span will narrow down these details, and show related input, output, and metadata.
Additionally, you can view the execution graph view of the trace, which shows the control and data flow of the trace, which will scale with larger agents to show handoffs and relationships between LLM calls, tool calls, and agent interactions.