> ## 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.process_initial_messages

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

#### process\_initial\_messages

```python theme={null}
process_initial_messages(
    messages: list[dict[str, Any]] | str,
    user_agent: ForwardRef('ConversableAgent') | None,
    agents: list['ConversableAgent'],
    wrapped_agents: list['ConversableAgent']
) -> tuple[list[dict[str, Any]], ConversableAgent | None, list[str], list[Agent]]
```

Process initial messages, validating agent names against messages, and determining the last agent to speak.<br />

<b>Parameters:</b>

| Name             | Description                                                                                                                   |
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `messages`       | Initial messages to process.<br /><br />**Type:** list\[dict\[str, typing.Any]] \| str                                        |
| `user_agent`     | Optional user proxy agent passed in to a\_/initiate\_group\_chat.<br /><br />**Type:** ForwardRef('ConversableAgent') \| None |
| `agents`         | Agents in the group.<br /><br />**Type:** list\['ConversableAgent']                                                           |
| `wrapped_agents` | List of wrapped agents.<br /><br />**Type:** list\['ConversableAgent']                                                        |

<b>Returns:</b>

| Type                                                                                                                           | Description                                                                                                                                                                       |
| ------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| tuple\[list\[dict\[str, typing.Any]], ConversableAgent \| None, list\[str], list\[[Agent](/docs/api-reference/autogen/Agent)]] | list\[dict\[str, Any]]: Processed message(s). Agent: Last agent to speak. list\[str]: List of agent names. list\[Agent]: List of temporary user proxy agents to add to GroupChat. |

<br />
