chat method
Make sure these imports are in script.
from rich.console import Console import date time import getpass
update the main script.
create def main()
make sure you have full path for model
qwen/qwen3.5-9b
def main() -> None: agent = Agent( model="qwen/qwen3.5-9b", system_prompt="Tell me a joke in chinese at end of response", ) @agent.context def user_context() -> str: return( # f"Current data and time: {datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n" f"Current data and time: {datetime.datetime.now().strftime('%Y-%m- %H:%M:%S')}\n" f"Current User: {getpass.getuser()}\n" ) console = Console with console.status("[dim]Thinking...[/dim]",spinner="arc"): response = agent.chat('What time is it and who am i') console.print(f"[blue]You: [/blue] what time is it now") console.print(f"[blue]Ai Assistant:[/blue] {response}") if __name__ == '__init__main__': main()