Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

added langfuse

Gregor Žunič4b1d6f48d76d
diff --git a/requirements.txt b/requirements.txt
index f43d37271..d01670165 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -3,7 +3,6 @@ Screenshot==1.0.0
Selenium-Screenshot==2.1.0
beautifulsoup4==4.12.3
langchain==0.3.7
-# langchain-core==0.3.15
langchain-openai==0.2.5
pydantic==2.9.2
pytest==8.3.3
@@ -12,4 +11,5 @@ python-dotenv==1.0.1
requests==2.32.3
selenium==4.26.1
tokencost==0.1.16
-webdriver-manager==4.0.2
\ No newline at end of file
+webdriver-manager==4.0.2
+langfuse==2.53.5 # TODO: remove in prod
\ No newline at end of file
diff --git a/src/tests/test_kayak_search.py b/src/tests/test_kayak_search.py
index db86af236..10174601d 100644
--- a/src/tests/test_kayak_search.py
+++ b/src/tests/test_kayak_search.py
@@ -4,10 +4,18 @@ import os
import pytest
from langchain_anthropic import ChatAnthropic
from langchain_openai import ChatOpenAI
+from langfuse import Langfuse
+from langfuse.decorators import observe
from src.agent.service import AgentService
from src.controller.service import ControllerService
+langfuse = Langfuse(
+ secret_key=os.getenv('LANGFUSE_SECRET_KEY'),
+ public_key=os.getenv('LANGFUSE_PUBLIC_KEY'),
+ host=os.getenv('LANGFUSE_HOST'),
+)
+
def setup_run_folder(timestamp_prefix: str) -> str:
timestamp = f'{timestamp_prefix}_{datetime.datetime.now().strftime("%Y-%m-%d")}'
@@ -26,6 +34,7 @@ def setup_run_folder(timestamp_prefix: str) -> str:
# run with pytest src/tests/test_kayak_search.py -v -s
# @pytest.mark.skip
@pytest.mark.asyncio
+@observe()
async def test_kayak_flight_search():
task = 'go to kayak.com andfind a flight from Bali to Kirgistan on 2024-11-25 for 2 people one way.'
run_folder = setup_run_folder('kayak_com_flight_search2')