# format_to_tool_messages

> **Function** in `langchain_classic`

📖 [View in docs](https://reference.langchain.com/python/langchain-classic/agents/format_scratchpad/tools/format_to_tool_messages)

Convert (AgentAction, tool output) tuples into `ToolMessage` objects.

## Signature

```python
format_to_tool_messages(
    intermediate_steps: Sequence[tuple[AgentAction, str]],
) -> list[BaseMessage]
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `intermediate_steps` | `Sequence[tuple[AgentAction, str]]` | Yes | Steps the LLM has taken to date, along with observations. |

## Returns

`list[BaseMessage]`

list of messages to send to the LLM for the next prediction.

---

[View source on GitHub](https://github.com/langchain-ai/langchain/blob/fb6ab993a73180538f6cca876b3c85d46c08845f/libs/langchain/langchain_classic/agents/format_scratchpad/tools.py#L51)