# Create\_react\_agent internal loop

**URL:** <https://forum.langchain.com/t/create-react-agent-internal-loop/641>\
**Category:** LangGraph\
**Tags:** cloud, intro-to-langgraph, python-help\
**Created:** [July 23, 2025, 5:23am UTC](https://forum.langchain.com/t/create-react-agent-internal-loop/641 "2025-07-23T05:23:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ibrahim](https://avatars.discourse-cdn.com/v4/letter/i/43a26b/32.png) [@ibrahim](https://forum.langchain.com/u/ibrahim)\
**Post date:** [July 23, 2025, 5:23am UTC](https://forum.langchain.com/t/create-react-agent-internal-loop/641/1 "2025-07-23T05:23:51Z")

</div>

Does a react\_agent.invoke too, runs a loop internally like an AgentExecutor and return the final result after finishing the entire execution? This is what i am seeing which is surprising.

1. Why would I use an AgentExecutor then?
2. Is there a way to see the Action, Though output using an agent created with create\_react\_agent (the way a ZERO\_SHOT\_REACT\_AGENT gives?

Code:  
langgraph\_agent = create\_react\_agent(model, tools, prompt=prompt)  
messages = langgraph\_agent.invoke({“messages”: [(“human”, query)]})

---

<div class="post-metadata">

**Author:** ![AbdulBasit](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/abdulbasit/32/72_2.png) [@AbdulBasit](https://forum.langchain.com/u/AbdulBasit)\
**Post date:** [July 24, 2025, 7:55am UTC](https://forum.langchain.com/t/create-react-agent-internal-loop/641/2 "2025-07-24T07:55:11Z")

</div>

Yes, `create_react_agent().invoke()` runs a complete loop internally and returns the final result, similar to AgentExecutor. The difference is that `create_react_agent` creates a LangGraph-based agent which offers better state management, streaming, and debugging capabilities compared to the legacy AgentExecutor.

To see intermediate steps (Action/Thought outputs), use streaming instead of `invoke()`:

```auto
for event in langgraph_agent.stream({"messages": [("human", query)]}):
    print(event) # Shows each step including tool calls and thoughts

```

Or use `astream_events()` for more granular control over what intermediate data you want to observe during execution.

---

<div class="post-metadata">

**Author:** ![ibrahim](https://avatars.discourse-cdn.com/v4/letter/i/43a26b/32.png) [@ibrahim](https://forum.langchain.com/u/ibrahim)\
**Post date:** [July 24, 2025, 8:20am UTC](https://forum.langchain.com/t/create-react-agent-internal-loop/641/3 "2025-07-24T08:20:47Z")

</div>

Thanks, @AbdulBasit . Much appreciated.
