File size: 872 Bytes
06ba83e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from agency_swarm.tools import BaseTool
from pydantic import Field

class SendMessage(BaseTool):
    """
    A tool for sending messages between agents in the agency.
    """
    my_primary_instructions: str = Field(
        ...,
        description="Primary instructions or context for the message"
    )
    recipient: str = Field(
        ...,
        description="The name of the agent to send the message to"
    )
    message: str = Field(
        ...,
        description="The message content to be sent"
    )
    additional_instructions: str = Field(
        "",
        description="Any additional instructions or context for the message"
    )

    def run(self):
        """
        Execute the message sending operation.
        Returns the message details as a formatted string.
        """
        return f"Message sent to {self.recipient}: {self.message}"