Skip to main content
This page summarizes the main configuration surfaces.

ILLA SDK configuration

The IllaSDK class accepts configuration for API connectivity and internal state components.

Basic configuration

import { IllaSDK } from '@illalabs/sdk'

const sdk = new IllaSDK({
  apiKey: process.env.ILLA_API_KEY!,
})

With custom cache

import { IllaSDK, InMemoryCache } from '@illalabs/sdk'

const sdk = new IllaSDK(
  { apiKey: process.env.ILLA_API_KEY! },
  { cache: new InMemoryCache() },
)

With context manager options

import { IllaSDK } from '@illalabs/sdk'

const sdk = new IllaSDK(
  { apiKey: process.env.ILLA_API_KEY! },
  {
    contextManagerOptions: {
      cacheKeyPrefix: 'illa:sdk:ctx',
      defaultToolsConfig: {
        autoRouter: { swapOrBridge: 'lifi' },
      },
    },
  },
)

With custom context manager

import { IllaSDK, InMemoryCache } from '@illalabs/sdk'

const cache = new InMemoryCache()
const contextManager = IllaSDK.createNewContextManager(cache, {
  cacheKeyPrefix: 'my-app:ctx',
  defaultToolsConfig: {},
})

const sdk = new IllaSDK(
  { apiKey: process.env.ILLA_API_KEY! },
  { contextManager },
)

CoreApiProvider config

import { CoreApiProvider } from '@illalabs/sdk'

const provider = new CoreApiProvider({
  headers: { 'x-api-key': process.env.ILLA_API_KEY! },
  timeout: 30_000,
  routes: {
    chat: '/api/v1/chat/',
    actionStatus: '/api/v1/actions/check',
  },
})
Notes:
  • x-api-key is required.
  • timeout is in milliseconds.
  • Route overrides are useful for proxies and gateway path rewrites.

ContextManager options

const contextManager = new ContextManager(new InMemoryCache(), {
  cacheKeyPrefix: 'illa:sdk:ctx',
  defaultToolsConfig: {
    autoRouter: { swapOrBridge: 'lifi' },
  },
})

Cache entry TTL

await cache.set('key', value, { ttl: 5 * 60_000 })
TTL values are milliseconds.