Skip to content

Commit d4daecb

Browse files
committed
[feat]: add langsmith tracing
1 parent 3fb8be5 commit d4daecb

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

backend/app/agents/devrel/tools/search_tool.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from typing import List, Dict, Any
44
from tavily import TavilyClient
55
from app.core.config import settings
6+
from langsmith import traceable
67

78
logger = logging.getLogger(__name__)
89

@@ -12,6 +13,7 @@ class TavilySearchTool:
1213
def __init__(self):
1314
self.client = TavilyClient(api_key=settings.tavily_api_key) if settings.tavily_api_key else None
1415

16+
@traceable(name="tavily_search_tool", run_type="tool")
1517
async def search(self, query: str, max_results: int = 5) -> List[Dict[str, Any]]:
1618
"""Perform web search using Tavily"""
1719
try:

backend/app/agents/shared/classification_router.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from langchain_google_genai import ChatGoogleGenerativeAI
77
from langchain_core.prompts import ChatPromptTemplate
88
from app.core.config import settings
9+
from langsmith import traceable
910

1011
logger = logging.getLogger(__name__)
1112

@@ -73,6 +74,7 @@ def _setup_prompts(self):
7374
("human", "Message: {message}\nContext: {context}")
7475
])
7576

77+
@traceable(name="user_intent_classification", run_type="llm")
7678
async def classify_message(self, message: str, context: Dict[str, Any] = None) -> Dict[str, Any]:
7779
"""Classify a message and determine if DevRel intervention is needed"""
7880
try:

backend/app/core/orchestration/agent_coordinator.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# from app.agents.github.agent import GitHubAgent
77
from app.agents.shared.state import AgentState
88
from app.core.orchestration.queue_manager import AsyncQueueManager
9+
from langsmith import traceable
910

1011
logger = logging.getLogger(__name__)
1112

@@ -27,6 +28,7 @@ def _register_handlers(self):
2728
# TODO: Register GitHub agent handler after implementation
2829
# self.queue_manager.register_handler("github_request", self._handle_github_request)
2930

31+
@traceable(name="devrel_request_coordination", run_type="chain")
3032
async def _handle_devrel_request(self, message_data: Dict[str, Any]):
3133
"""Handle DevRel agent requests"""
3234
try:

0 commit comments

Comments
 (0)