# Run the agent and stream the messages to the console.
async def main() -> None:
    tracer = trace.get_tracer(__name__)
    with tracer.start_as_current_span("agent_conversation") as span:
        task = "What is the weather in New York?"

        span.set_attribute("input", task) # Manually log the question
        res = await Console(agent.run_stream(task=task))

        # Manually log the response
        span.set_attribute("output", res.messages[-1].content)

        # Close the connection to the model client.
        await model_client.close()


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

## Further improvements

If you would like to see us improve this integration, simply open a new feature
request on [Github](https://github.com/comet-ml/opik/issues).