# external_tools_condition

> **Function** in `langchain_azure_ai`

📖 [View in docs](https://reference.langchain.com/python/langchain-azure-ai/agents/_v2/prebuilt/factory/external_tools_condition)

Determine the next node based on whether the AI message has tool calls.

## Signature

```python
external_tools_condition(
    state: MessagesState,
) -> Literal['tools', '__end__']
```

---

[View source on GitHub](https://github.com/langchain-ai/langchain-azure/blob/7a6a664d617264df8dcb12fcfb1bacc09f21d504/libs/azure-ai/langchain_azure_ai/agents/_v2/prebuilt/factory.py#L108)