Skip to main content
This page walks through your first Engine call from Python. We use httpx because it has good streaming support and a nice async API, but anything that speaks HTTP and can read SSE will work.

Install

A minimal client

Save this as engine_quickstart.py:
Set your environment and run:
You should see the agent’s reply stream into your terminal, one chunk at a time.

Async version

If your application is async, here’s the same client using httpx.AsyncClient:

Handling other event types

In the example above we only print text_delta events. The Engine emits many more — tool calls, thinking blocks, HITL requests, lifecycle events. A more complete handler would route on event type:
To get the event type from the SSE stream you need to track event: lines as well as data: lines:

Continuing a task

Reusing the same task_id continues the same conversation thread. The Engine pulls the relevant memory and history automatically:

Where to go next