LangSmith tracing for a deep agent: key may write but not read
To trace a langgraph/deepagents run: set LANGSMITH_TRACING=true plus LANGSMITH_API_KEY (and LANGSMITH_PROJECT) before the first traced call, force tracing off when the key is missing so nothing fails, and name the run via config run_name/tags/metadata. Pass config run_id only for the first segment, because a resumed segment must be its own trace. A key can ingest traces yet return 403 on GET /sessions and read_run, so a trace URL cannot be built through the API; save the trace id, project and metadata in the run folder and search by metadata in the UI. langsmith caches env lookups (utils.get_env_var.cache_clear). Also surfaced by tracing-era runs: log a failing tool as a run event and let the runtime build the plan if the agent never calls build_plan.