Skip to main content
IllaSDK is the main SDK client. Use it when you want one object to manage chat sessions, tool-result loops, and async action polling.

Typical usage

When to use IllaSDK

Use IllaSDK if your integration needs:
  • a high-level chat client
  • chat ID management
  • helper methods for returning tool results
  • polling utilities for long-running actions
If you need lower-level control over transport or context storage, use Chat, CoreApiProvider, and ContextManager directly.

Constructor

The constructor accepts API transport settings in config and context/cache customization in options.

config

string
required
API key used as x-api-key for Core API requests.
string
Optional Core API base URL override.
number
HTTP timeout in milliseconds.
Record<string, string>
Extra headers merged into requests.
HttpClientFactory
Optional Axios client factory.
CoreApiProviderRoutes
Optional route overrides (chat, actionStatus).

options

Provide either:
  • cache + optional contextManagerOptions, or
  • contextManager (custom implementation)

Property

chatIds: string[]

List of active chat IDs managed by the instance.

Core workflow

Most integrations use IllaSDK in this order:
  1. sendMessage(...) to start or continue a chat
  2. inspect response.data.pendingTools
  3. execute the returned tools in your app
  4. sendToolResults(...) to continue the loop
  5. use polling helpers if the action completes asynchronously

Core methods

sendMessage

Starts or continues a chat turn. When creating a new chat via { userContext }, you can include signerWallet for smart-account flows where a separate EOA signs transactions/messages. This is the main entry point for non-streaming chat requests.

sendMessageStreaming

Streams telemetry and final result via a single SSE request. Use this when you want streaming events and the final assistant response from a single request.

sendToolResult

Sends one tool outcome.

sendToolResults

Sends multiple tool outcomes in one request. Throws SdkEmptyToolsResultsError if toolResults is empty. The returned SendMessageResult can include:
  • Final assistant text (response.data.text)
  • Additional pendingTools (for multi-step tool loops)
Use sendToolResults for the common case. It reduces request overhead and keeps the tool loop explicit.

Chat and context methods

Use these methods when you need direct access to stored conversation state or want to manage chat instances manually.

Polling methods

Polling config units are seconds. Use polling after you have already submitted a transaction or other long-running tool action and want status updates.

Utilities

Tool loop example