import uuid
from langchain_core.messages import HumanMessage
import zeroeval as ze
DEMO_TAGS = {"example": "langgraph_tags_demo", "project": "zeroeval"}
SESSION_ID = str(uuid.uuid4())
SESSION_INFO = {"id": SESSION_ID, "name": "Tags Demo Session"}
with ze.span(
name="demo.root_invoke",
session=SESSION_INFO,
tags={**DEMO_TAGS, "run": "invoke"},
):
# 1️⃣ Tag the *current* span only
current_span = ze.get_current_span()
ze.set_tag(current_span, {"phase": "pre-run"})
# 2️⃣ Tag the whole trace – root + all children (past *and* future)
current_trace = ze.get_current_trace()
ze.set_tag(current_trace, {"run_mode": "invoke"})
# 3️⃣ Tag the entire session
current_session = ze.get_current_session()
ze.set_tag(current_session, {"env": "local"})
result = app.invoke({"messages": [HumanMessage(content="hello")], "count": 0})