Track your AI Agents FREE! (LangTrace)

Mervin PraisonAbout 3 min readJul 29, 2025Watch original
THE SUMMARYAI-generated

Key Concepts

  • AI Agents: Software entities designed to perform tasks autonomously.
  • Observability: The ability to understand the internal state of a system from its external outputs.
  • Langtrace: An open-source observability tool for AI applications.
  • Langchain: A framework for building applications powered by language models.
  • Llama Index: A data framework for building LLM applications.
  • Crew AI: A framework for orchestrating multiple AI agents to work together.
  • RAG (Retrieval-Augmented Generation): An AI framework that combines information retrieval with text generation.
  • Docker: A platform for containerizing applications.
  • API Key: A code used to authenticate and authorize access to an API.

1. Introduction to Langtrace

  • AI agents are powerful, but optimizing them requires understanding their internal operations.
  • Langtrace is introduced as an open-source observability tool designed to monitor AI applications.
  • It allows users to track interactions, identify time-consuming functions, and optimize performance.

2. Key Features of Langtrace

  • Metrics: Tracks total cost, human evaluation, dataset creation, prompts, registry, and settings.
  • Backend Monitoring: Provides insights into backend processes that drive frontend chatbots.
  • Integrations: Supports integrations with O Lama, Autogen, Gemini, Langchain, Llama Index, and Crew AI.
  • Accessibility: Available on GitHub for free local use.

3. Installation Process Using Docker

  • Step 1: Cloning the Repository:
    • Clone the Langtrace repository from GitHub using the command: git clone [repository URL] langtrace.
  • Step 2: Docker Setup:
    • Ensure Docker is installed from docker.com.
    • Navigate to the Langtrace folder in the terminal.
    • Run docker compose up -d to start Langtrace.
  • Step 3: Verification:
    • Verify the application is running using docker ps.
    • Access Langtrace at localhost:3000.
  • Step 4: Login Credentials:
    • Find default credentials in the .env file within the cloned repository.
    • The default username is "admin" and the password can be found in the .env file.
    • Credentials can be modified in the .env file.

4. Setting Up Langtrace

  • Project Creation:
    • Create a new project within the Langtrace application (e.g., "AI agents default").
  • Integration Code:
    • Add two lines of code to integrate Langtrace into AI applications.
  • API Key Generation:
    • Generate an API key within Langtrace and copy it.
  • SDK Installation:
    • Install the Langtrace Python SDK using pip install langtrace llama-index langchain crewai.
  • Environment Variables:
    • Export OpenAI API key: export OPENAI_API_KEY=[your_openai_api_key].
    • Export Langtrace API key: export LANTRACE_API_KEY=[your_langtrace_api_key].

5. Integration with Langchain

  • Application Overview:
    • A simple RAG application that retrieves data from soccer rules and answers questions (e.g., "What is offside?").
  • Integration Steps:
    • Import Langtrace: import langtrace.
    • Add the Langtrace API key and host to the environment variables.
  • Running the Application:
    • Execute the Langchain application using python langchain_app.py.
  • Monitoring:
    • Observe traces in the Langtrace UI, showing API calls and performance metrics.

6. Integration with Llama Index

  • Application Overview:
    • Similar RAG application using Llama Index to search soccer rules and answer questions.
  • Integration:
    • Integrate Langtrace using the same two lines of code as with Langchain.
  • Execution:
    • Run the Llama Index application using python llama_index_app.py.
  • Trace Analysis:
    • View detailed steps in Langtrace, such as document loading, embedding creation, and embedding retrieval.

7. Integration with Crew AI

  • Setup:
    • Install required packages and export API keys.
    • Add the same two lines of Langtrace integration code.
  • Monitoring:
    • Langtrace automatically tracks the Crew AI application.

8. Conclusion

  • Langtrace provides valuable observability for AI applications, allowing developers to trace API calls and optimize performance.
  • It supports multiple integrations and can be run locally for free.
  • The presenter encourages viewers to try Langtrace and provide feedback.
  • A recommendation is made to watch another video on creating RAG applications.

AI summaries can miss context or contain errors. Check important details against the original video.

Go a little deeper.

Have a question about this video? Load its transcript to open the video chat.