autogen_agentchat.messages#

autogen_agentchat.messages.AgentMessage = autogen_agentchat.messages.TextMessage | autogen_agentchat.messages.MultiModalMessage | autogen_agentchat.messages.StopMessage | autogen_agentchat.messages.HandoffMessage | autogen_agentchat.messages.ToolCallMessage | autogen_agentchat.messages.ToolCallResultMessage#

All message types.

pydantic model autogen_agentchat.messages.BaseMessage[source]#

Bases: BaseModel

A base message.

Show JSON schema
{
   "title": "BaseMessage",
   "description": "A base message.",
   "type": "object",
   "properties": {
      "source": {
         "title": "Source",
         "type": "string"
      },
      "models_usage": {
         "anyOf": [
            {
               "$ref": "#/$defs/RequestUsage"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      }
   },
   "$defs": {
      "RequestUsage": {
         "properties": {
            "prompt_tokens": {
               "title": "Prompt Tokens",
               "type": "integer"
            },
            "completion_tokens": {
               "title": "Completion Tokens",
               "type": "integer"
            }
         },
         "required": [
            "prompt_tokens",
            "completion_tokens"
         ],
         "title": "RequestUsage",
         "type": "object"
      }
   },
   "required": [
      "source"
   ]
}

Fields:
field models_usage: RequestUsage | None = None#

The model client usage incurred when producing this message.

field source: str [Required]#

The name of the agent that sent this message.

autogen_agentchat.messages.ChatMessage = autogen_agentchat.messages.TextMessage | autogen_agentchat.messages.MultiModalMessage | autogen_agentchat.messages.StopMessage | autogen_agentchat.messages.HandoffMessage#

Messages for agent-to-agent communication.

pydantic model autogen_agentchat.messages.HandoffMessage[source]#

Bases: BaseMessage

A message requesting handoff of a conversation to another agent.

Show JSON schema
{
   "title": "HandoffMessage",
   "description": "A message requesting handoff of a conversation to another agent.",
   "type": "object",
   "properties": {
      "source": {
         "title": "Source",
         "type": "string"
      },
      "models_usage": {
         "anyOf": [
            {
               "$ref": "#/$defs/RequestUsage"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "target": {
         "title": "Target",
         "type": "string"
      },
      "content": {
         "title": "Content",
         "type": "string"
      }
   },
   "$defs": {
      "RequestUsage": {
         "properties": {
            "prompt_tokens": {
               "title": "Prompt Tokens",
               "type": "integer"
            },
            "completion_tokens": {
               "title": "Completion Tokens",
               "type": "integer"
            }
         },
         "required": [
            "prompt_tokens",
            "completion_tokens"
         ],
         "title": "RequestUsage",
         "type": "object"
      }
   },
   "required": [
      "source",
      "target",
      "content"
   ]
}

Fields:
field content: str [Required]#

The handoff message to the target agent.

field target: str [Required]#

The name of the target agent to handoff to.

autogen_agentchat.messages.InnerMessage = autogen_agentchat.messages.ToolCallMessage | autogen_agentchat.messages.ToolCallResultMessage#

Messages for intra-agent monologues.

pydantic model autogen_agentchat.messages.MultiModalMessage[source]#

Bases: BaseMessage

A multimodal message.

Show JSON schema
{
   "title": "MultiModalMessage",
   "description": "A multimodal message.",
   "type": "object",
   "properties": {
      "source": {
         "title": "Source",
         "type": "string"
      },
      "models_usage": {
         "anyOf": [
            {
               "$ref": "#/$defs/RequestUsage"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "content": {
         "items": {
            "anyOf": [
               {
                  "type": "string"
               },
               {}
            ]
         },
         "title": "Content",
         "type": "array"
      }
   },
   "$defs": {
      "RequestUsage": {
         "properties": {
            "prompt_tokens": {
               "title": "Prompt Tokens",
               "type": "integer"
            },
            "completion_tokens": {
               "title": "Completion Tokens",
               "type": "integer"
            }
         },
         "required": [
            "prompt_tokens",
            "completion_tokens"
         ],
         "title": "RequestUsage",
         "type": "object"
      }
   },
   "required": [
      "source",
      "content"
   ]
}

Fields:
field content: List[str | Image] [Required]#

The content of the message.

pydantic model autogen_agentchat.messages.StopMessage[source]#

Bases: BaseMessage

A message requesting stop of a conversation.

Show JSON schema
{
   "title": "StopMessage",
   "description": "A message requesting stop of a conversation.",
   "type": "object",
   "properties": {
      "source": {
         "title": "Source",
         "type": "string"
      },
      "models_usage": {
         "anyOf": [
            {
               "$ref": "#/$defs/RequestUsage"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "content": {
         "title": "Content",
         "type": "string"
      }
   },
   "$defs": {
      "RequestUsage": {
         "properties": {
            "prompt_tokens": {
               "title": "Prompt Tokens",
               "type": "integer"
            },
            "completion_tokens": {
               "title": "Completion Tokens",
               "type": "integer"
            }
         },
         "required": [
            "prompt_tokens",
            "completion_tokens"
         ],
         "title": "RequestUsage",
         "type": "object"
      }
   },
   "required": [
      "source",
      "content"
   ]
}

Fields:
field content: str [Required]#

The content for the stop message.

pydantic model autogen_agentchat.messages.TextMessage[source]#

Bases: BaseMessage

A text message.

Show JSON schema
{
   "title": "TextMessage",
   "description": "A text message.",
   "type": "object",
   "properties": {
      "source": {
         "title": "Source",
         "type": "string"
      },
      "models_usage": {
         "anyOf": [
            {
               "$ref": "#/$defs/RequestUsage"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "content": {
         "title": "Content",
         "type": "string"
      }
   },
   "$defs": {
      "RequestUsage": {
         "properties": {
            "prompt_tokens": {
               "title": "Prompt Tokens",
               "type": "integer"
            },
            "completion_tokens": {
               "title": "Completion Tokens",
               "type": "integer"
            }
         },
         "required": [
            "prompt_tokens",
            "completion_tokens"
         ],
         "title": "RequestUsage",
         "type": "object"
      }
   },
   "required": [
      "source",
      "content"
   ]
}

Fields:
field content: str [Required]#

The content of the message.

pydantic model autogen_agentchat.messages.ToolCallMessage[source]#

Bases: BaseMessage

A message signaling the use of tools.

Show JSON schema
{
   "title": "ToolCallMessage",
   "description": "A message signaling the use of tools.",
   "type": "object",
   "properties": {
      "source": {
         "title": "Source",
         "type": "string"
      },
      "models_usage": {
         "anyOf": [
            {
               "$ref": "#/$defs/RequestUsage"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "content": {
         "items": {
            "$ref": "#/$defs/FunctionCall"
         },
         "title": "Content",
         "type": "array"
      }
   },
   "$defs": {
      "FunctionCall": {
         "properties": {
            "id": {
               "title": "Id",
               "type": "string"
            },
            "arguments": {
               "title": "Arguments",
               "type": "string"
            },
            "name": {
               "title": "Name",
               "type": "string"
            }
         },
         "required": [
            "id",
            "arguments",
            "name"
         ],
         "title": "FunctionCall",
         "type": "object"
      },
      "RequestUsage": {
         "properties": {
            "prompt_tokens": {
               "title": "Prompt Tokens",
               "type": "integer"
            },
            "completion_tokens": {
               "title": "Completion Tokens",
               "type": "integer"
            }
         },
         "required": [
            "prompt_tokens",
            "completion_tokens"
         ],
         "title": "RequestUsage",
         "type": "object"
      }
   },
   "required": [
      "source",
      "content"
   ]
}

Fields:
field content: List[FunctionCall] [Required]#

The tool calls.

pydantic model autogen_agentchat.messages.ToolCallResultMessage[source]#

Bases: BaseMessage

A message signaling the results of tool calls.

Show JSON schema
{
   "title": "ToolCallResultMessage",
   "description": "A message signaling the results of tool calls.",
   "type": "object",
   "properties": {
      "source": {
         "title": "Source",
         "type": "string"
      },
      "models_usage": {
         "anyOf": [
            {
               "$ref": "#/$defs/RequestUsage"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "content": {
         "items": {
            "$ref": "#/$defs/FunctionExecutionResult"
         },
         "title": "Content",
         "type": "array"
      }
   },
   "$defs": {
      "FunctionExecutionResult": {
         "properties": {
            "content": {
               "title": "Content",
               "type": "string"
            },
            "call_id": {
               "title": "Call Id",
               "type": "string"
            }
         },
         "required": [
            "content",
            "call_id"
         ],
         "title": "FunctionExecutionResult",
         "type": "object"
      },
      "RequestUsage": {
         "properties": {
            "prompt_tokens": {
               "title": "Prompt Tokens",
               "type": "integer"
            },
            "completion_tokens": {
               "title": "Completion Tokens",
               "type": "integer"
            }
         },
         "required": [
            "prompt_tokens",
            "completion_tokens"
         ],
         "title": "RequestUsage",
         "type": "object"
      }
   },
   "required": [
      "source",
      "content"
   ]
}

Fields:
field content: List[FunctionExecutionResult] [Required]#

The tool call results.