The current CLI experience is centered on interactive mode.
For one-shot/scripted usage, use the SDK or HTTP endpoint directly.
Option 1: SDK one-shot call
import { DZapSDK } from "@dzapio/ai";
const sdk = new DZapSDK();
await sdk.initialize();
const result = await sdk.ask({
userQuery: "Price of ETH and BTC on Ethereum",
metadata: {
accountInfo: [{ blockchain: "evm", chain: "1", user_account: "0xabc..." }],
},
});
console.log(result.finalText);
Option 2: HTTP /ask_stream (Server-Sent Events)
The server exposes a single streaming endpoint, POST /ask_stream. The body
uses user_query, session_id, and metadata.accountInfo[]:
curl -N -X POST "https://nlp-ai-439689868940.europe-north1.run.app/ask_stream" \
-H "Content-Type: application/json" \
-d "{\"user_query\":\"Show ETH price\",\"session_id\":\"script-1\",\"metadata\":{\"accountInfo\":[{\"blockchain\":\"evm\",\"chain\":\"1\",\"user_account\":\"0xabc...\"}]}}"
The response is Content-Type: text/event-stream. It emits one step event per
tool call, a final finalText event, then [DONE]:
data: {"chatId":"script-1","response":{"type":"step","tool_name":"PriceTool","data":"...","session_id":"script-1"}}
data: {"chatId":"script-1","response":{"type":"finalText","data":"ETH price is ...","session_id":"script-1","chain_id":"1"}}
data: [DONE]
When the assistant fetches balances for the UI, the final event also carries
balance_data and balance_ui: true.
When to use which mode
| Mode | Best for |
|---|
| Interactive CLI | Manual workflows and confirmations |
| SDK | Backend services and typed Node apps |
HTTP /ask_stream (SSE) | Language-agnostic, real-time streamed agent output |
Last modified on June 18, 2026