> ## 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

<span id="atoti_ai.AiConfig" />

> atoti\_ai.AiConfig(<br />
>     \*,<br />
>     *connection*: [ConnectionConfig](./atoti_ai.config.ConnectionConfig#atoti_ai.ConnectionConfig) | [None](https://docs.python.org/3/library/constants.html#None) = `None`,<br />
>     *chat*: [ChatConfig](./atoti_ai.config.ChatConfig#atoti_ai.ChatConfig) | [None](https://docs.python.org/3/library/constants.html#None) = `None`,<br />
>     *chat\_enabled*: [bool](https://docs.python.org/3/library/functions.html#bool) = `True`,<br />
>     *disclaimer*: [str](https://docs.python.org/3/library/stdtypes.html#str) = `'AI can make mistakes, please double check response.'`,<br />
>     *dynamic\_tool\_discovery*: [bool](https://docs.python.org/3/library/functions.html#bool) | [None](https://docs.python.org/3/library/constants.html#None) = `None`,<br />
>     *max\_attempts*: [int](https://docs.python.org/3/library/functions.html#int) = `5`,<br />
>     *prompt*: [PromptConfig](./atoti_ai.config.PromptConfig#atoti_ai.PromptConfig) = `PromptConfig(timeout=datetime.timedelta(seconds=300), max_consecutive_identical_tool_calls=3, max_tool_errors=5, max_consecutive_refused_rounds=3, max_retry_attempts=1)`,<br />
>     *auto\_explain*: [AutoExplainConfig](./atoti_ai.config.AutoExplainConfig#atoti_ai.AutoExplainConfig) = `AutoExplainConfig(retained_run_count=100, run_lifetime=datetime.timedelta(seconds=6000))`,<br />
>     *mcp*: [McpClientConfig](./atoti_ai.config.mcp.McpClientConfig#atoti_ai.McpClientConfig) | [None](https://docs.python.org/3/library/constants.html#None) = `None`,<br />
> )

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)
```

<Callout icon="link">
  **See also**:
  [`atoti.Cube.auto_explain`](./atoti.Cube.auto_explain#atoti.Cube.auto_explain) and [`atoti.Session.chat`](./atoti.Session.chat#atoti.Session.chat).
</Callout>

### Attributes

<h4 id="atoti_ai.AiConfig.connection">
  *connection*
</h4>

The configuration of the connection to the LLM provider.

<h4 id="atoti_ai.AiConfig.chat">
  *chat*
</h4>

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.

<h4 id="atoti_ai.AiConfig.chat_enabled">
  *chat\_enabled*
</h4>

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.

<Info>
  Added in version 6.2.1.
</Info>

<h4 id="atoti_ai.AiConfig.disclaimer">
  *disclaimer*
</h4>

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

<h4 id="atoti_ai.AiConfig.dynamic_tool_discovery">
  *dynamic\_tool\_discovery*
</h4>

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.

<Info>
  Added in version 6.2.1.
</Info>

<h4 id="atoti_ai.AiConfig.max_attempts">
  *max\_attempts*
</h4>

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).

<Info>
  Added in version 6.2.1.
</Info>

<h4 id="atoti_ai.AiConfig.prompt">
  *prompt*
</h4>

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

<Info>
  Added in version 6.2.1.
</Info>

<h4 id="atoti_ai.AiConfig.auto_explain">
  *auto\_explain*
</h4>

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

<Info>
  Added in version 6.2.1.
</Info>

<h4 id="atoti_ai.AiConfig.mcp">
  *mcp*
</h4>

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

<Info>
  Added in version 6.2.1.
</Info>
