mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-05-22 16:06:50 +00:00
923f516deb
* feat(trace):LangGraph -> lead_agent and set user custom agent name to run_name * feat(trace):follow github copilot suggest * feat(trace):Refactor run_name resolution and improve test coverage
17 lines
582 B
Python
17 lines
582 B
Python
"""Run naming helpers for LangChain/LangSmith tracing."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from collections.abc import Mapping
|
|
from typing import Any
|
|
|
|
|
|
def resolve_root_run_name(config: Mapping[str, Any], assistant_id: str | None) -> str:
|
|
for container_name in ("context", "configurable"):
|
|
container = config.get(container_name)
|
|
if isinstance(container, Mapping):
|
|
agent_name = container.get("agent_name")
|
|
if isinstance(agent_name, str) and agent_name.strip():
|
|
return agent_name
|
|
return assistant_id or "lead_agent"
|