> ## Documentation Index
> Fetch the complete documentation index at: https://docs.illa.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Tools configuration

> Control which tools the assistant can use and preferred providers

Tool routing configuration is modeled by `ToolAutorouterRequest` from `@illalabs/interfaces`.

<Tip>
  Start with SDK defaults unless you need deterministic routing behavior.
  Most integrations should not define the full autorouter config initially.
</Tip>

## Using the ILLA SDK

Set default routing via `contextManagerOptions.defaultToolsConfig`.

```ts theme={null}
import { IllaSDK } from '@illalabs/sdk'

const sdk = new IllaSDK(
  { apiKey: process.env.ILLA_API_KEY! },
  {
    contextManagerOptions: {
      defaultToolsConfig: {
        autoRouter: {
          swapOrBridge: 'lifi',
          defi: { lending: 'aave' },
        },
      },
    },
  },
)
```

## Per-chat configuration with a custom ContextManager

```ts theme={null}
import { IllaSDK, InMemoryCache } from '@illalabs/sdk'

const cache = new InMemoryCache()
const contextManager = IllaSDK.createNewContextManager(cache, {
  defaultToolsConfig: {
    autoRouter: {
      swapOrBridge: 'lifi',
    },
  },
})

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

const chat = sdk.createChat({
  userContext: { address: '0x1234...' },
})
```

## Read current configuration

```ts theme={null}
const snapshot = await sdk.getChat(chatId).getContext()
console.log(snapshot.toolsConfig)
```

## Update configuration on an existing chat

```ts theme={null}
const chat = sdk.getChat(chatId)
const snapshot = await chat.getContext()

await chat.setContext({
  ...snapshot,
  toolsConfig: {
    autoRouter: {
      swapOrBridge: 'lifi',
      defi: { lending: 'aave' },
    },
  },
})
```

## Notes

* Configuration is persisted in the chat context.
* `ContextManager` deep-clones stored config to avoid accidental mutation.
