# `LangChain.Chains.LLMChain.Modes.WhileNeedsResponse`
[🔗](https://github.com/brainlid/langchain/blob/v0.8.0/lib/chains/llm_chain/modes/while_needs_response.ex#L1)

Execution mode that loops while the chain needs a response.

After each LLM call, if the response contains tool calls, this mode:
1. Executes the pending tool calls
2. Calls the LLM again with the tool results
3. Repeats until `needs_response` is false (no more tool calls)

The LLM always gets the last word after tool execution.

## Usage

    LLMChain.run(chain, mode: :while_needs_response)
    # or
    LLMChain.run(chain, mode: LangChain.Chains.LLMChain.Modes.WhileNeedsResponse)

---

*Consult [api-reference.md](api-reference.md) for complete listing*
