File tree Expand file tree Collapse file tree 7 files changed +945
-581
lines changed
template_langgraph/services/streamlits/pages Expand file tree Collapse file tree 7 files changed +945
-581
lines changed Original file line number Diff line number Diff line change 55# # Project Settings
66PROJECT_NAME = template-langgraph
77
8+ # ---------
9+ # Observability
10+ # ---------
11+
812# # LangSmith Settings
913LANGSMITH_TRACING = " false" # Options: "true", "false"
1014LANGSMITH_API_KEY = " lsv2_xxx"
1115
16+ # # Langfuse Settings
17+ LANGFUSE_PUBLIC_KEY = " pk-lf-..."
18+ LANGFUSE_SECRET_KEY = " sk-lf-..."
19+ LANGFUSE_HOST = " https://cloud.langfuse.com"
20+
1221# ---------
1322# LLMs
1423# ---------
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ DOCKER_COMMAND ?=
6262
6363# Tools
6464TOOLS_DIR ?= /usr/local/bin
65- TRIVY_VERSION ?= 0.58.1
65+ TRIVY_VERSION ?= 0.67.2
6666
6767.PHONY : docker-build
6868docker-build : # # build Docker image
@@ -93,9 +93,10 @@ docker-lint: ## lint Dockerfile
9393
9494.PHONY : docker-scan
9595docker-scan : # # scan Docker image
96- @# https://aquasecurity.github.io/trivy/v0.18.3/installation/#install-script
97- @which trivy || curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b $(TOOLS_DIR ) v$(TRIVY_VERSION )
98- trivy image $(DOCKER_REPO_NAME ) /$(DOCKER_IMAGE_NAME ) :$(GIT_TAG )
96+ @echo " Disabling trivy scan temporarily"
97+ # @# https://aquasecurity.github.io/trivy/v0.18.3/installation/#install-script
98+ # @which trivy || curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b $(TOOLS_DIR) v$(TRIVY_VERSION)
99+ # trivy image $(DOCKER_REPO_NAME)/$(DOCKER_IMAGE_NAME):$(GIT_TAG)
99100
100101.PHONY : ci-test-docker
101102ci-test-docker : docker-lint docker-build docker-scan docker-run # # run CI test for Docker
Original file line number Diff line number Diff line change 106106### [ LiteLLM] ( https://docs.litellm.ai/ )
107107
108108- [ Azure OpenAI] ( https://docs.litellm.ai/docs/providers/azure/ )
109+
110+ ### [ Langfuse] ( https://langfuse.com/ )
111+
112+ - [ Cookbook: LangGraph Integration] ( https://langfuse.com/guides/cookbook/integration_langgraph )
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ dependencies = [
2525 " langchain-ollama>=0.3.6" ,
2626 " langchain-openai>=0.3.28" ,
2727 " langchain-text-splitters>=0.3.9" ,
28+ " langfuse>=3.6.2" ,
2829 " langgraph>=0.6.2" ,
2930 " langgraph-supervisor>=0.0.29" ,
3031 " mlflow>=3.4.0" ,
Original file line number Diff line number Diff line change 44import typer
55from dotenv import load_dotenv
66from langchain_core .runnables .config import RunnableConfig
7+ from langfuse .langchain import CallbackHandler
78
89from template_langgraph .agents .chat_with_tools_agent .agent import graph as chat_with_tools_agent_graph
910from template_langgraph .agents .image_classifier_agent .agent import graph as image_classifier_agent_graph
@@ -126,6 +127,9 @@ def run(
126127 },
127128 config = RunnableConfig (
128129 recursion_limit = recursion_limit ,
130+ callbacks = [
131+ CallbackHandler (),
132+ ],
129133 ),
130134 ):
131135 logger .info ("-" * 20 )
@@ -181,6 +185,9 @@ def news_summarizer_agent(
181185 ),
182186 config = RunnableConfig (
183187 recursion_limit = recursion_limit ,
188+ callbacks = [
189+ CallbackHandler (),
190+ ],
184191 ),
185192 ):
186193 logger .info ("-" * 20 )
@@ -242,6 +249,9 @@ def image_classifier_agent(
242249 ),
243250 config = RunnableConfig (
244251 recursion_limit = recursion_limit ,
252+ callbacks = [
253+ CallbackHandler (),
254+ ],
245255 ),
246256 ):
247257 logger .info ("-" * 20 )
Original file line number Diff line number Diff line change 88from langchain_community .callbacks .streamlit import (
99 StreamlitCallbackHandler ,
1010)
11+ from langfuse .langchain import CallbackHandler
1112
1213from template_langgraph .agents .chat_with_tools_agent .agent import (
1314 AgentState ,
@@ -296,7 +297,12 @@ def build_graph_messages() -> list:
296297def invoke_agent (graph_messages : list ) -> AgentState :
297298 return st .session_state ["graph" ].invoke (
298299 {"messages" : graph_messages },
299- {"callbacks" : [StreamlitCallbackHandler (st .container ())]},
300+ {
301+ "callbacks" : [
302+ StreamlitCallbackHandler (st .container ()),
303+ CallbackHandler (),
304+ ]
305+ },
300306 )
301307
302308
You can’t perform that action at this time.
0 commit comments