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

Execution mode that loops until a specific tool is called.

Repeatedly calls the LLM and executes tools until a tool result
matching one of the target tool names is found.

## Options

- `:tool_names` — (required) List of tool name strings to watch for.
- `:max_runs` — Maximum LLM calls before error. Default: 25.

## Usage

    LLMChain.run(chain,
      mode: LangChain.Chains.LLMChain.Modes.UntilToolUsed,
      tool_names: ["submit"],
      max_runs: 25
    )
    # => {:ok, chain, %ToolResult{name: "submit", ...}}

---

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