This example demonstrates how to handle streaming messages. The server sends a stream of pongs and the client receives and prints them.
First, follow the instructions in Prerequisites and Installation.
Start a server in one terminal:
python examples/stream-ping-pong/server.py
Then communicate with the agent in another terminal:
coagent stream_server -H type:Ping --chat
Install the following packages:
pip install hypercorn
pip install starlette
pip install sse-starlette
Start the HTTP runtime server:
python examples/ping-pong/http_runtime_server.py
Then start a server in one terminal:
python examples/stream-ping-pong/server.py --server http://localhost:8000
Finally, start a client in another terminal.
coagent stream_server -H type:Ping --chat --server http://localhost:8000