The print_message method displays custom messages in the Narada extension’s side panel chat. This is different from Python’s regular print() function - use this method when you want to show messages to end users viewing the chat or inject messages into the chat history for agents to read later.
This method only displays messages in the Narada extension side panel chat. If you just want to print something to your Python console, use the regular print() function instead.

Method Signature

async def print_message(
    self,
    *,
    message: str,
    timeout: int | None = None,
) -> None

Parameters

message
str
required
The text message to display in the side panel chat.
message="Task completed successfully!"
message="Processing item 3 of 10..."
timeout
int | None
default:"None"
Maximum time in seconds to wait for the message to be displayed. If None, uses the default system timeout.
timeout=10     # Wait up to 10 seconds
timeout=None   # Use default timeout

Return Value

This method returns None and completes when the message has been displayed.

Example

import asyncio
from narada import Narada

async def main():
    async with Narada() as narada:
        window = await narada.open_and_initialize_browser_window()

        # Show a message in the chat
        await window.print_message(message="Starting data extraction...")

        # Perform automation
        await window.go_to_url(url="https://example.com")
        response = await window.agent(prompt="extract the page title")

        # Show results in the chat
        await window.print_message(message=f"Extracted title: {response.text}")

if __name__ == "__main__":
    asyncio.run(main())