Splunk Agent Observability Instrumentation for LangChain Apps
Quickstart Setup
Start by adding the Galileo SDK to the travel planner’s environment and initializing Splunk Agent Observability tracing.
Activate Environment
Navigate to the app directory and activate the virtual environment you created in Monitoring Agentic AI Applications (or create a fresh one):
cd ~/workshop/agentic-ai/base-app
python3 -m venv .venv
source .venv/bin/activateInstall Galileo SDK
Install the Galileo SDK alongside the app’s existing dependencies in the requirements.txt:
pip install -r requirements.txt
pip install galileo python-dotenvThe app already installs langchain, langchain-openai, langgraph, and flask via its
requirements.txt. The Galileo LangChain callback ships with the galileo package.
Configure Galileo credentials
Your EC2 instance comes pre-configured with OPENAI_API_KEY and OPENAI_BASE_URL environment variables, which will be used by the application.
Add your credentials to the app’s .env file.
OPENAI_API_KEY="your-openai-api-key"
OPENAI_BASE_URL="https://lite-llm-proxy.splunko11y.com/v1"
GALILEO_API_KEY="your-galileo-api-key"
GALILEO_CONSOLE_URL="https://console.multitenant.galileocloud.io"
# Recommended: uncomment to group this workshop's traces under their own project
# and log stream. If you leave these commented out, Splunk Agent Observability uses a project and log
# stream both named "default".
# GALILEO_PROJECT="Workshop19"
# GALILEO_LOG_STREAM="TravelPlanner"Uncommenting GALILEO_PROJECT and GALILEO_LOG_STREAM keeps the workshop traces easy to find.
Leaving them commented is fine too — your traces will just land in the default project and
default log stream.
- Initialize Galileo near the top of
main.py, right after the existing imports andload_dotenv()call. Passing the environment variables through means the project and log stream come from your.envwhen set, and fall back to Splunk Agent Observability’sdefault/defaultwhen not:
from dotenv import load_dotenv
load_dotenv()
import os
from galileo import galileo_context
galileo_context.init(project=os.getenv("GALILEO_PROJECT"),
log_stream=os.getenv("GALILEO_LOG_STREAM"))If you leave GALILEO_PROJECT and GALILEO_LOG_STREAM commented out in your .env, where will
your traces show up in Splunk Agent Observability?
