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

# AiConfig

> atoti\_ai.AiConfig(\
>
>     \*,\
>
>     *connection*: [ConnectionConfig](https://docs.activeviam.com/engine/python-sdk/6.2/api/atoti_ai.config.ConnectionConfig.md#atoti_ai.ConnectionConfig) | [None](https://docs.python.org/3/builtins/constants.html#None) = `None`,\
>
>     *chat*: [ChatConfig](https://docs.activeviam.com/engine/python-sdk/6.2/api/atoti_ai.config.ChatConfig.md#atoti_ai.ChatConfig) | [None](https://docs.python.org/3/builtins/constants.html#None) = `None`,\
>
>     *chat\_enabled*: [bool](https://docs.python.org/3/builtins/functions.html#bool) = `True`,\
>
>     *disclaimer*: [str](https://docs.python.org/3/builtins/stdtypes.html#str) = `'AI can make mistakes, please double check response.'`,\
>
>     *dynamic\_tool\_discovery*: [bool](https://docs.python.org/3/builtins/functions.html#bool) | [None](https://docs.python.org/3/builtins/constants.html#None) = `None`,\
>
>     *max\_attempts*: [int](https://docs.python.org/3/builtins/functions.html#int) = `5`,\
>
>     *prompt*: [PromptConfig](https://docs.activeviam.com/engine/python-sdk/6.2/api/atoti_ai.config.PromptConfig.md#atoti_ai.PromptConfig) = `PromptConfig()`,\
>
>     *auto\_explain*: [AutoExplainConfig](https://docs.activeviam.com/engine/python-sdk/6.2/api/atoti_ai.config.AutoExplainConfig.md#atoti_ai.AutoExplainConfig) = `AutoExplainConfig()`,\
>
>     *mcp*: [McpClientConfig](https://docs.activeviam.com/engine/python-sdk/6.2/api/atoti_ai.config.mcp.McpClientConfig.md#atoti_ai.McpClientConfig) | [None](https://docs.python.org/3/builtins/constants.html#None) = `None`,\
>
>     *streaming*: [bool](https://docs.python.org/3/builtins/functions.html#bool) = `False`,\
>
>     *thinking*: [bool](https://docs.python.org/3/builtins/functions.html#bool) = `False`,\
>
> )

Atoti Intelligence configuration.

The default [`disclaimer`](#atoti_ai.AiConfig.disclaimer):

```pycon theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
>>> _fetch_ai_disclaimer(session_with_ai)
'AI can make mistakes, please double check response.'
```

Changing the disclaimer:

```pycon theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
>>> import os
>>> from atoti_ai import AiConfig
>>> from atoti_ai_amazon_bedrock import ConnectionConfig, ChatConfig
>>> connection_config = ConnectionConfig(
...     aws_access_key=os.environ["AWS_ACCESS_KEY_ID"],
...     aws_secret_key=os.environ["AWS_SECRET_ACCESS_KEY"],
...     aws_region="eu-west-3",
... )
>>> chat_config = ChatConfig(
...     model="eu.anthropic.claude-sonnet-4-6",
... )
>>> custom_disclaimer = "Custom disclaimer."
>>> ai_config = AiConfig(
...     connection=connection_config,
...     chat=chat_config,
...     disclaimer=custom_disclaimer,
... )
>>> session_config = tt.SessionConfig(ai=ai_config)
```

Opting out of [`dynamic_tool_discovery`](#atoti_ai.AiConfig.dynamic_tool_discovery):

```pycon theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
>>> import atoti as tt
>>> import os
>>> from atoti_ai import AiConfig
>>> from atoti_ai_amazon_bedrock import ConnectionConfig, ChatConfig
>>> connection_config = ConnectionConfig(
...     aws_access_key=os.environ["AWS_ACCESS_KEY_ID"],
...     aws_secret_key=os.environ["AWS_SECRET_ACCESS_KEY"],
...     aws_region="eu-west-3",
... )
>>> chat_config = ChatConfig(
...     model="eu.anthropic.claude-sonnet-4-6",
... )
>>> ai_config = AiConfig(
...     connection=connection_config,
...     chat=chat_config,
...     dynamic_tool_discovery=False,
... )
>>> session_config = tt.SessionConfig(ai=ai_config)
```

Disabling the chat endpoint:

```pycon theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
>>> import atoti as tt
>>> import os
>>> from atoti_ai import AiConfig
>>> from atoti_ai_amazon_bedrock import ConnectionConfig, ChatConfig
>>> connection_config = ConnectionConfig(
...     aws_access_key=os.environ["AWS_ACCESS_KEY_ID"],
...     aws_secret_key=os.environ["AWS_SECRET_ACCESS_KEY"],
...     aws_region="eu-west-3",
... )
>>> chat_config = ChatConfig(
...     model="eu.anthropic.claude-sonnet-4-6",
... )
>>> ai_config = AiConfig(
...     connection=connection_config,
...     chat=chat_config,
...     chat_enabled=False,
... )
>>> session_config = tt.SessionConfig(ai=ai_config)
```

Keeping more Auto-Explain analyses retrievable from the chat, for longer:

```pycon theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
>>> import atoti as tt
>>> import os
>>> from datetime import timedelta
>>> from atoti_ai import AiConfig, AutoExplainConfig
>>> from atoti_ai_amazon_bedrock import ConnectionConfig, ChatConfig
>>> connection_config = ConnectionConfig(
...     aws_access_key=os.environ["AWS_ACCESS_KEY_ID"],
...     aws_secret_key=os.environ["AWS_SECRET_ACCESS_KEY"],
...     aws_region="eu-west-3",
... )
>>> chat_config = ChatConfig(
...     model="eu.anthropic.claude-sonnet-4-6",
... )
>>> ai_config = AiConfig(
...     connection=connection_config,
...     chat=chat_config,
...     auto_explain=AutoExplainConfig(
...         retained_run_count=500,
...         run_lifetime=timedelta(hours=8),
...     ),
... )
>>> session_config = tt.SessionConfig(ai=ai_config)
```

Streaming the answer as the model writes it:

```pycon theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
>>> import atoti as tt
>>> import os
>>> from atoti_ai import AiConfig
>>> from atoti_ai_amazon_bedrock import ConnectionConfig, ChatConfig
>>> connection_config = ConnectionConfig(
...     aws_access_key=os.environ["AWS_ACCESS_KEY_ID"],
...     aws_secret_key=os.environ["AWS_SECRET_ACCESS_KEY"],
...     aws_region="eu-west-3",
... )
>>> chat_config = ChatConfig(
...     model="eu.anthropic.claude-sonnet-4-6",
... )
>>> ai_config = AiConfig(
...     connection=connection_config,
...     chat=chat_config,
...     streaming=True,
... )
>>> session_config = tt.SessionConfig(ai=ai_config)
```

**See also**:
[`atoti.Cube.auto_explain`](./atoti.Cube.auto_explain#atoti.Cube.auto_explain) and [`atoti.Session.chat`](./atoti.Session.chat#atoti.Session.chat).

### Attributes

#### *connection*

The configuration of the connection to the LLM provider.

#### *chat*

The configuration of the LLM this session prompts.

This is not [`chat_enabled`](#atoti_ai.AiConfig.chat_enabled): the LLM configured here serves every AI feature needing one, such as summarizing an [`atoti.Cube.auto_explain`](./atoti.Cube.auto_explain#atoti.Cube.auto_explain) analysis.

#### *chat\_enabled*

Whether this session serves the chat endpoint.

This only has an impact if an LLM is configured (i.e. both [`connection`](#atoti_ai.AiConfig.connection) and [`chat`](#atoti_ai.AiConfig.chat) are not `None`).

* `True`: the AI chat in Atoti UI is usable.
* `False`: the AI chat in Atoti UI cannot be used and [`atoti.Session.chat`](./atoti.Session.chat#atoti.Session.chat) is `None`, but the LLM stays enabled so [`auto_explain`](./atoti.Cube.auto_explain#atoti.Cube.auto_explain) summaries are still generated.

> [!NOTE]
>
> Added in version 6.2.1.

#### *disclaimer*

The disclaimer displayed in Atoti UI next to AI-generated content.

#### *dynamic\_tool\_discovery*

Whether the chat sends the LLM only the tools matching each request.

* `True`: the LLM calls a tool-search tool that queries a keyword index.
  It receives only the matching tools, which reduces prompt token usage and improves tool selection.
* `False`: the whole tool set is sent on every request.
  A small tool set, where searching brings no benefit, is one reason to do so.
  Inspecting which tools the LLM can see is another.
* `None`: the server enables this if the license includes Atoti Intelligence Essentials, and leaves it disabled otherwise.

> [!NOTE]
>
> Added in version 6.2.1.

#### *max\_attempts*

How many times a call to the LLM is sent, retries included.

A failed request is re-sent by the provider’s own client, backing off between
attempts.
This bounds that for whichever provider the session connects to, taking precedence over the provider’s own property.

Set it to `1` to disable retries.
Each attempt is bounded by the connection timeouts.
Some providers have a dedicated option for this:
\* [`atoti_ai_amazon_bedrock.ConnectionConfig.timeout`](./atoti_ai_amazon_bedrock.ConnectionConfig#atoti_ai_amazon_bedrock.ConnectionConfig.timeout).

> [!NOTE]
>
> Added in version 6.2.1.

#### *prompt*

What one chat prompt may spend before the session gives up on it.

> [!NOTE]
>
> Added in version 6.2.1.

#### *auto\_explain*

The configuration of [`atoti.Cube.auto_explain`](./atoti.Cube.auto_explain#atoti.Cube.auto_explain).

> [!NOTE]
>
> Added in version 6.2.1.

#### *mcp*

The configuration of the MCP servers to take additional tools from.

> [!NOTE]
>
> Added in version 6.2.1.

#### *streaming*

Whether the chat sends its answer as the model writes it, instead of in one piece.

A streamed answer is delivered as AG-UI `TEXT_MESSAGE_CHUNK` events.

This is the default of each run: an AG-UI request setting the `streaming` forwarded prop overrides it, either way.

* `True`: a run streams its answer.
* `False`: a run sends its answer once it ends.

> [!WARNING]
>
> The Atoti UI AI extension shipped with this version renders each chunk in place of the previous one instead of appending it.
> Keep this off for sessions served to Atoti UI.

> [!NOTE]
>
> Added in version 6.2.3.

#### *thinking*

Whether a streamed answer also carries the model’s reasoning trace.

This only applies to a run that streams its answer, whether through [`streaming`](#atoti_ai.AiConfig.streaming) or through the `streaming` forwarded prop of its AG-UI request.
Whether a trace exists at all depends on the LLM provider: OpenAI-family models stream one, Google models need thoughts to be requested, and Amazon Bedrock Converse reports none.

* `True`: the reasoning trace is streamed ahead of the answer.
* `False`: the server sends no reasoning trace.

> [!NOTE]
>
> Added in version 6.2.3.
