autogen_ext.agents.file_surfer#

class FileSurfer(name: str, model_client: ChatCompletionClient, description: str = 'An agent that can handle local files.')[source]#

Bases: BaseChatAgent

An agent, used by MagenticOne, that acts as a local file previewer. FileSurfer can open and read a variety of common file types, and can navigate the local file hierarchy.

DEFAULT_DESCRIPTION = 'An agent that can handle local files.'#
DEFAULT_SYSTEM_MESSAGES = [SystemMessage(content='\n        You are a helpful AI Assistant.\n        When given a user query, use available functions to help the user with their request.', type='SystemMessage')]#
async on_messages(messages: Sequence[Annotated[TextMessage | MultiModalMessage | StopMessage | ToolCallSummaryMessage | HandoffMessage, FieldInfo(annotation=NoneType, required=True, discriminator='type')]], cancellation_token: CancellationToken) Response[source]#

Handles incoming messages and returns a response.

Note

Agents are stateful and the messages passed to this method should be the new messages since the last call to this method. The agent should maintain its state between calls to this method. For example, if the agent needs to remember the previous messages to respond to the current message, it should store the previous messages in the agent state.

async on_reset(cancellation_token: CancellationToken) None[source]#

Resets the agent to its initialization state.

property produced_message_types: Tuple[type[Annotated[TextMessage | MultiModalMessage | StopMessage | ToolCallSummaryMessage | HandoffMessage, FieldInfo(annotation=NoneType, required=True, discriminator='type')]], ...]#

The types of messages that the agent produces in the Response.chat_message field. They must be ChatMessage types.