Skip to main content
This guide takes you from zero to your first streamed agent response. You’ll install the SDK, create a Compose Key, send a message to a deployed agent, and watch the text arrive in real time.

1. Install the SDK

Requires Node.js 20 or later.

2. Initialize the client

userAddress is your EVM wallet address. chainId is the chain you’ll settle payments on — 43113 is Avalanche Fuji testnet.

3. Create a Compose Key

A Compose Key is a bearer token that handles payment server-side. You create it once and the SDK stores and reuses it automatically.

4. Stream an agent response

Pick any deployed agent and send a message. The response comes back as an SSE stream of typed events.

5. Handle events

Iterate the stream and handle the events you care about. The most common is text-delta — a fragment of the agent’s reply.

6. Get the final result

After the stream ends, the iterator resolves with a final result containing the full text, tool call summaries, and the payment receipt.

The complete script

That’s a complete paid agent call. The SDK handled authentication, payment negotiation, SSE parsing, and receipt extraction — you only wrote the event loop.

Next