> ## Documentation Index
> Fetch the complete documentation index at: https://private-04b27de1.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# autogen.agentchat.group.group_utils.get_last_agent_speaker

<code class="doc-symbol doc-symbol-heading doc-symbol-function" />

#### get\_last\_agent\_speaker

```python theme={null}
get_last_agent_speaker(
    groupchat: GroupChat,
    group_agent_names: list[str],
    tool_executor: GroupToolExecutor
) -> Agent
```

Get the last group agent from the group chat messages. Not including the tool executor.

<b>Parameters:</b>

| Name                | Description                                                                                                      |
| ------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `groupchat`         | **Type:** [GroupChat](/docs/api-reference/autogen/GroupChat)                                                     |
| `group_agent_names` | **Type:** list\[str]                                                                                             |
| `tool_executor`     | **Type:** [GroupToolExecutor](/docs/api-reference/autogen/agentchat/group/group_tool_executor/GroupToolExecutor) |

<br />
