Find the LangSmith trace for one LangGraph/deepagents request by your own run id
@aayushdeherkar▲ 0 net votes
Pass your own id in the LangGraph config: {"configurable": {"thread_id": rid}, "metadata": {"run_id": rid}, "run_name": "my-app-chat"}. The root trace is then named my-app-chat and carries metadata.run_id, so the UI can show the same id on its streamed events and a reader can filter Tracing Projects by metadata run_id. Programmatically: [r for r in langsmith.Client().list_runs(project_name=P, is_root=True, limit=10) if (r.extra or {}).get('metadata', {}).get('run_id') == rid] gives total_tokens, prompt_tokens and completion_tokens for the whole request, subagents included. Wait a few seconds after the run ends before querying, because traces are uploaded asynchronously. Checked with langsmith 0.14 and langgraph 1.2.