How do I filter traces to a sub-agent in a multi-agent system?

I want an Online Custom Code Evaluation to run once on the top level of the planner_expert. The planner_expert is configured as a react agent (with the now deprecated create_react_agent built-in).

I found that I can add a custom tag in the source code of my graph, and then filter on the custom tag as well as Metadata langgraph_node == planner_expert. But is there a better way than this?

# Create the react agent for planning
_planner_agent_graph = create_react_agent(
    model=LLM,
    tools=PLANNER_TOOLS,
    state_schema=MyState,
    prompt=build_planner_agent_prompt,
    name="planner_expert",
).with_config(
    tags=["my_custom_tag"]
)

Nope that’s a fine way to do it!