Skip to content

GenerateCodeExecutionReplyEvent

autogen.events.agent_events.GenerateCodeExecutionReplyEvent #

GenerateCodeExecutionReplyEvent(*, uuid=None, code_blocks, sender=None, recipient)

Bases: BaseEvent

Source code in autogen/events/agent_events.py
def __init__(
    self,
    *,
    uuid: Optional[UUID] = None,
    code_blocks: list[Union["CodeBlock", str]],
    sender: Optional[Union["Agent", str]] = None,
    recipient: Union["Agent", str],
):
    code_blocks = [
        code_block.language if hasattr(code_block, "language") else code_block for code_block in code_blocks
    ]
    sender = sender or "No sender"

    super().__init__(
        uuid=uuid,
        code_blocks=code_blocks,
        sender=sender.name if hasattr(sender, "name") else sender,
        recipient=recipient.name if hasattr(recipient, "name") else recipient,
    )

code_blocks instance-attribute #

code_blocks

sender instance-attribute #

sender

recipient instance-attribute #

recipient

uuid instance-attribute #

uuid

print #

print(f=None)
Source code in autogen/events/agent_events.py
def print(self, f: Optional[Callable[..., Any]] = None) -> None:
    f = f or print

    num_code_blocks = len(self.code_blocks)
    if num_code_blocks == 1:
        f(
            colored(
                f"\n>>>>>>>> EXECUTING CODE BLOCK (inferred language is {self.code_blocks[0]})...",
                "red",
            ),
            flush=True,
        )
    else:
        f(
            colored(
                f"\n>>>>>>>> EXECUTING {num_code_blocks} CODE BLOCKS (inferred languages are [{', '.join([x for x in self.code_blocks])}])...",
                "red",
            ),
            flush=True,
        )