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
source .venv/bin/activateInstall Galileo SDK
Install the Galileo SDK alongside the app’s existing dependencies:
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
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 Splunk Agent Observability 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:
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?
