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

**URL:** <https://forum.langchain.com/t/how-do-i-filter-traces-to-a-sub-agent-in-a-multi-agent-system/2038>\
**Category:** Observability & Evals\
**Created:** [October 31, 2025, 7:38pm UTC](https://forum.langchain.com/t/how-do-i-filter-traces-to-a-sub-agent-in-a-multi-agent-system/2038 "2025-10-31T19:38:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aerickson-clt](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/aerickson-clt/32/501_2.png) [@aerickson-clt](https://forum.langchain.com/u/aerickson-clt)\
**Post date:** [October 31, 2025, 7:38pm UTC](https://forum.langchain.com/t/how-do-i-filter-traces-to-a-sub-agent-in-a-multi-agent-system/2038/1 "2025-10-31T19:38:54Z")

</div>

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).

 ![image](https://canada1.discourse-cdn.com/flex007/uploads/langchain/original/2X/d/d41e9519187853b4fb7c3282ef8fbb8a7c750f74.png)

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?

```python
# 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"]
)

```

---

<div class="post-metadata">

**Author:** ![jacoblee9315](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/jacoblee9315/32/441_2.png) [@jacoblee9315](https://forum.langchain.com/u/jacoblee9315)\
**Post date:** [November 1, 2025, 4:04pm UTC](https://forum.langchain.com/t/how-do-i-filter-traces-to-a-sub-agent-in-a-multi-agent-system/2038/2 "2025-11-01T16:04:04Z")

</div>

Nope that’s a fine way to do it!
