---
title: Migrate to 0.19
description: The breaking changes of each 0.19.x release, in full, and what to change for each.
---

# Migrate to 0.19

This page holds the breaking changes of each 0.19.x release in full, and what to change for each. The [Changelog](../help/changelog.md) lists every change in one line. Read every section from the release after the one you are on, up to the one you move to, newest first. Each change is marked as in the changelog: **BREAKING** fails to compile or link, and a marker such as **BREAKING (behavior only)** changes what running code does without failing to compile.

## 0.19.1

Nothing fails to compile, but the change below alters behavior at run time.

### `FileGuard.checkWrite` follows symbolic links

**BREAKING (behavior only):** `file_write`, `image_convert`, `slides_create`, `pdf_merge` and `pdf_to_image` check where a write really lands, as `FileGuard.checkRead` does for a read. The guard resolves the target's real path, or for a target that does not exist yet, the real path of its deepest existing parent. A write is refused with a `SecurityException` when that real path lies outside the real sandbox root (the working directory unless `TNSAI_FILE_SANDBOX_ROOT` sets one), or when it goes through a broken symbolic link. When the target exists as a link, the real file must also carry an extension the toolkit allows. Replace such links with the real file or folder, or move the target inside the root.

The check runs before the write, not atomically with it, as for a read: a link swapped in between is not caught. Keep the sandbox root out of reach of other writers when that matters.

## 0.19.0

Nothing fails to compile, but each change below alters behavior at run time.

### `markitdown` downloads a URL source itself and caps the CLI

**BREAKING (behavior only):** `markitdown` no longer hands an `http(s)` source to the CLI. It downloads the URL itself through `GuardedFetcher`, with the SSRF guard on every redirect hop, so a URL or hop that names a loopback, private, link-local or other non-public address is refused, as in `web_scraper`, and so is a URL the JVM's default `ProxySelector` would send through a proxy, with `blocked by SSRF guard: '<host>' would be fetched through HTTP proxy …`. The download is capped at `MarkdownTools.MAX_DOWNLOAD_BYTES` (50 MiB) and fails rather than truncates, with `markitdown — download over the 52428800-byte cap: <url>`; a body declared over the cap is refused before it is read. The fetch, redirects included, has 60 seconds, and a read that waits 15 seconds for data fails. The CLI then converts the local copy, with `--mime-type` and `--charset` hints where the response's content type names a known format. It needs markitdown 0.1.0 or later: upgrade the CLI before you upgrade TnsAI. To reach a private address or fetch through a proxy, call `MarkdownTools.allowPrivateNetwork(true)` or set `TNSAI_HTTP_ALLOW_PRIVATE` to `1`, `true` or `yes`.

**BREAKING (behavior only):** `markitdown` caps the CLI's stdout and stderr at 10 MiB each and its run time at 60 seconds. The CLI writes to temp files instead of pipes, so a CLI writing a lot to stderr no longer deadlocks. On a cap, a timeout or an interrupt, the CLI and every process it started are killed, and the call fails with `markitdown — output over the 10485760-byte cap converting <source>` or `markitdown timed out after …`. Split a document whose Markdown passes 10 MiB, or one that takes the CLI longer than 60 seconds, before you convert it.

### `http_request` returns at most 500 KB of a body

**BREAKING (behavior only):** `http_request` returns at most the first 500,000 bytes of a response body, followed by `[truncated: response body over 500000 bytes]` on a line of its own. Code that reads a larger body from the tool's result gets the cut body and the marker. Fetch such a body with your own HTTP client.

### `searxng` and `wikipedia` fetch under the SSRF guard, and `wikidata` checks its language

**BREAKING (behavior only):** `searxng` and `wikipedia` fetch through `GuardedFetcher` with the SSRF guard. `searxng` refuses an instance, or a redirect hop, that names a loopback, private, link-local or other non-public address, and both tools refuse a URL the client would fetch through a proxy, except the request to a trusted `searxng` instance, which the client may send through its proxy. The fetch follows up to 20 redirects, each hop has 15 seconds and the whole fetch 30. `wikipedia` refuses a language that is not an edition code: after lower-casing, letters and digits in hyphen-separated parts, starting with a letter, at most 63 characters, such as `en` or `zh-yue`. The refusal is an `IllegalArgumentException` whose message repeats the argument cut to 32 characters, with its control, format, line separator, paragraph separator and unpaired surrogate characters written as `\u` escapes. Their HTTP error messages change to the form `searxng — HTTP 503 fetching <url>`, and a fetch also fails with `too many redirects` or `fetch deadline of … ms passed`. To reach a private instance or fetch through a proxy, call `WebSearchTools.allowPrivateNetwork(true)` or set `TNSAI_HTTP_ALLOW_PRIVATE` to `1`, `true` or `yes`. Match the new messages where you matched the old ones.

For a self-hosted SearXNG instance, `WebSearchTools.trustSearxngInstance(String)` is the narrower choice: give it the instance's base URL, and `searxng` searches only there, at `<base>/search`, without the SSRF checks on that request; a redirect to any other URL stays guarded unless the private network is allowed. A call that names another `instance` is refused with an `IOException` before any request is sent, and a call with no `instance` searches the trusted one instead of `https://searx.be`. `null` clears the trust; an empty or blank URL, or one with user info, a query or a fragment, is rejected with an `IllegalArgumentException` and the previous trust stays.

**BREAKING (behavior only):** on a `WebSearchTools` built with your `OkHttpClient`, `searxng` and `wikipedia` fetch with a copy of that client, for the trusted `searxng` instance too. The copy keeps its TLS settings, client certificate included, and its resolver, behind the SSRF guard on a guarded hop. It uses your proxy settings only on a hop the guard is off for: the request to a trusted `searxng` instance, or every hop with the private network allowed. It drops your interceptors, network interceptors, `Authenticator`, `CookieJar` and HTTP cache, and hands your proxy authenticator only an HTTPS tunnel's `CONNECT` challenge. The fetch follows up to 20 redirects itself, gives each hop 15 seconds in place of your client's call timeout and the whole fetch 30 seconds, and sends its own `User-Agent`. A header, credential or cookie that one of those added no longer reaches these two tools' requests, your redirect settings and call timeout no longer apply to them, and no error says so. The other tools of `WebSearchTools` still use your client as given. Query an instance that needs such credentials with your own client.

**BREAKING (behavior only):** `wikidata` refuses a language that is not a code of letters, digits and single hyphens, such as `en` or `zh-hans`, as `wikipedia` does, where it used to put the argument into its query unencoded. Pass a Wikidata language code.

**BREAKING (behavior only):** `searxng` refuses a response body over 2 MiB after gzip decoding, with `searxng — response body over the 2097152-byte cap: <instance and path>`. Query an instance whose responses pass that size with your own client.

### `document_read` fetches URLs under the SSRF guard

**BREAKING (behavior only):** `document_read` fetches a URL through `GuardedFetcher` with the SSRF guard. It follows redirects and checks every hop, refuses a URL or hop that names a loopback, private, link-local or other non-public address, refuses a URL the client would fetch through a proxy, and gives the whole fetch, and each hop, 30 seconds; a read that waits 10 seconds for data fails. A body over `FileGuardConfig.maxReadBytes()` fails with `document_read — body over the N-byte read cap: <url>`; a body declared over the cap is refused before it is read. Its error messages change to the form `document_read — HTTP 404 fetching <url>`, and a fetch also fails with `too many redirects` or `fetch deadline of … ms passed`. To reach a private address or fetch through a proxy, call `DocumentTools.allowPrivateNetwork(true)` or set `TNSAI_HTTP_ALLOW_PRIVATE` to `1`, `true` or `yes`. To read a larger document, raise the read cap with `TNSAI_FILE_MAX_READ_BYTES` or the `FileGuardConfig` you pass.

**BREAKING (behavior only):** the `HttpClient` given to `DocumentTools(HttpClient, ObjectMapper)` or `DocumentTools(HttpClient, ObjectMapper, FileGuardConfig)` is no longer used; `document_read` fetches with its own client, so settings made on the one you pass no longer apply.

**BREAKING (behavior only):** with no format given, `document_read` detects one in this order:

1. a `Content-Type` naming HTML, PDF or Markdown;
2. the extension of the path of the URL the fetch ends on, the query left out: `.html` or `.htm`, `.pdf`, `.md` or `.markdown`, or `.txt`, which reads as HTML when the body looks like HTML and as text otherwise;
3. with none of those extensions, and unless the `Content-Type` is `text/*`, a body that starts with the `%PDF-` signature reads as PDF;
4. else HTML if the body looks like HTML, otherwise text.

The URL you pass is not consulted, so a `.pdf` link that redirects to a login page reads as that page. Pass the format explicitly where the server's `Content-Type` or the final URL does not name it.

### An `LLM` action run through an agent runs its tool calls

**BREAKING (behavior only):** an `LLM` action run through an agent (`Agent.executeAction`, `Agent.executeActionOnRole`, an agent tool call, `AgentToolExecutor.executeAction` or `AgentToolExecutor.executeActionOnRole`) sends the model tools and runs the model's tool calls through the agent's tool dispatcher, as chat does, up to 10 tool-call iterations. It used to send no tools and drop any tool call. With no tool loop in its context, as without an agent, it still makes one call. Check which tools such an action can now reach through its agent. The limit of 10 iterations is the same for every agent in 0.19.0: an agent offers no way to change it.

**BREAKING (behavior only):** an `LLM` action called while it already runs a tool loop further up the call chain fails that tool call with an `ActionExecutionException`: `Circular dependency detected: LLM action '<name>' is already running the tool loop that called it.` Do not let an `LLM` action reach itself through the tools its own loop runs.

### Retries and `@Fallback` stop on terminal failures

**BREAKING (behavior only):** `RetryPolicy.shouldRetry`, and so `AgentResilienceManager.execute` and `ResilienceExecutor`, retry a `RetrievalException` whose reason does not surface above the failure policy: `TIMEOUT`, `EXECUTION` or `SOURCE_LOADING`. One whose reason surfaces, `CONFIGURATION`, `PROVIDER_UNAVAILABLE` or `ENGINE_CLOSED`, is still not retried. Where a retry of a transient retrieval failure is unwanted, add `RetrievalException` to the policy's `abortOn(...)`. `abortOn` matches the failure itself, not its causes, so a `RetrievalException` wrapped in another exception is still retried; to stop that one too, give `retryIf(...)` a predicate that returns `false` when the cause chain holds a `RetrievalException`.

**BREAKING (behavior only):** an `LLM` action run through an agent is retried, by the agent's retry policy, `@Resilience`, the role's `ResilienceConfig` or `@Fallback(maxRetries)`, only while its tool loop has not started a tool call. Through `Agent.executeActionOnRole` or `AgentToolExecutor.executeActionOnRole`, the agent's retry policy and recovery do not run: only `@Resilience` on the action's method, else on its class, else the role's `ResilienceConfig`, and `@Fallback(maxRetries)` apply. Once a tool call has started, a failure is not retried, so no retry runs the action's tools a second time. An attempt that a timeout (`@Resilience(timeout)`, the role's `ResilienceConfig.timeoutMs` or `@Security(securityTimeout)`), a `@Fallback` or the agent's recovery took the loop from starts no new tool batch, even when its own model call returns one later; a batch whose check passed before the loop was taken still runs. Handle a failure after the first tool call where the action's caller gets it.

**BREAKING (behavior only):** no action, `LOCAL` or `LLM`, is retried by the agent's retry policy, `@Resilience`, `ResilienceConfig` or `@Fallback(maxRetries)`, or answered by its `@Fallback`, when its cause chain holds:

- a cancellation;
- an interrupt;
- a `RetrievalException` whose reason surfaces above the failure policy;
- an `AccountabilityWiringException`;
- an unauthorized denial.

The failure is rethrown instead. `@Resilience` on the action's method, else on its class, else the role's `ResilienceConfig`, and `@Fallback(maxRetries)` still retry a `RetrievalException` whose reason does not surface (`TIMEOUT`, `EXECUTION`, `SOURCE_LOADING`), and the action's `@Fallback` still answers one. When the agent runs an action (`Agent.executeAction`, an agent tool call or `AgentToolExecutor.executeAction`), its own retry policy and error recovery, around the action's, still end on any `RetrievalException`; `Agent.executeActionOnRole` and `AgentToolExecutor.executeActionOnRole` run neither, so there only `@Resilience`, else `ResilienceConfig`, and `@Fallback` decide. An `InterruptedIOException` counts as an interrupt only while the deciding thread is interrupted, so a socket or call timeout can still be retried. Such an interrupt in a chat tool call ends the turn, or the stream, with a `com.tnsai.cancellation.CancellationException`, and the agent's recovery manager is not handed it. Catch these failures where the action or the chat turn is called, instead of relying on a `@Fallback` to answer them. The typed overloads of `Agent.executeAction` and `Agent.executeActionOnRole`, which take an `ActionRequest` and return an `ActionResponse`, rethrow only a cancellation, of either `CancellationException` type, and a `RetrievalException` that is the failure itself; any other failure, an `AccountabilityWiringException` or an unauthorized denial included, comes back as a failed `ActionResponse` with its message. Check the response's failure there.

### A grace call propagates terminal failures

**BREAKING (behavior only):** in chat and in an `LLM` action's tool loop, a grace call failing with a cancellation, an interrupt, any `RetrievalException`, an `AccountabilityWiringException` or an unauthorized denial in its cause chain propagates it instead of returning `Maximum tool call iterations (N) reached.`; an interrupt propagates as a new `com.tnsai.cancellation.CancellationException`. The grace call is the one made when the iteration limit is reached. Any other failure of the grace call, or an empty answer, still returns that message. Catch the failure where the chat turn or the action is called; through a typed overload, only a cancellation or a `RetrievalException` that is the failure itself propagates, and another failure comes back as a failed `ActionResponse`.

### Other changes in behavior

These are not marked breaking, but code that relied on the old behavior notices them.

- The SSRF guard of `http_request`, `web_scraper` and `markitdown`, and a resolver wrapped with `SsrfGuard.over(Dns)`, refuse every address in `0.0.0.0/8`, and judge a NAT64 address in `64:ff9b::/96` by the IPv4 address it carries, so one that carries a private address is refused.
- `web_scraper` fetches through `GuardedFetcher`: each hop has 15 seconds and the whole fetch, redirects included, 30.
- The `instance` parameter of `searxng` no longer declares `https://searx.be` as its `@ToolParam` default; an omitted `instance` still means `https://searx.be` when no instance is trusted.
