> This is a page from the ElevenLabs documentation. For an index of the documentation, fetch https://elevenlabs.io/docs/llms.txt.

# Release client tool changes

A [client tool](/docs/eleven-agents/customization/tools/client-tools) has two halves that ship separately. The tool's definition lives on the server and is pushed from the SDK or the dashboard. Its handler lives in your frontend and reaches users only when they load a new release. This guide shows how to keep the two in step: each frontend release starts conversations on the agent version it was built against, and a breaking change to a tool ships as a new tool alongside the old one.

## How a tool change reaches deployed clients

Agents are [versioned](/docs/eleven-agents/operate/versioning). Tools aren't. A version records which tools an agent uses by their IDs, but a tool's definition, including its name and parameters, is stored on the tool and shared by every agent, branch and version that uses it. Updating a tool changes it everywhere at once. [Editing tools safely](/docs/eleven-agents/customization/tools/tool-configuration/editing-tools#how-tools-relate-to-branches-and-versions) describes this in detail.

This has two consequences for client tools:

* `agents.push()` updates a changed tool in place, so its new definition reaches every deployed copy of your frontend, including releases that only have the old handler. This happens even when you push to a branch.
* Pinning a frontend to an agent version protects it from changes to the agent's prompt, settings and attached tools, but not from changes to a tool's definition.

Treat a client tool that a released frontend uses as fixed. Make backward-compatible changes in place, and ship a breaking change as a new tool with a new name.

## Decide whether a change is breaking

A change is breaking if a handler that is already deployed can't handle what the agent now sends, or doesn't return what the agent now expects.

| Change                                                                     | Breaking | How to ship it                                    |
| -------------------------------------------------------------------------- | -------- | ------------------------------------------------- |
| Add an optional parameter                                                  | No       | Push in place, then release the updated handler.  |
| Reword the tool's or a parameter's description                             | No       | Push in place. It changes when the LLM calls it.  |
| Rename or remove a parameter                                               | Yes      | [New tool](#ship-a-breaking-change-as-a-new-tool) |
| Make a parameter required, change its type, or narrow its allowed values   | Yes      | [New tool](#ship-a-breaking-change-as-a-new-tool) |
| Change `expects_response`, or what the agent expects the handler to return | Yes      | [New tool](#ship-a-breaking-change-as-a-new-tool) |
| Rename the tool                                                            | Yes      | [New tool](#ship-a-breaking-change-as-a-new-tool) |

An added optional parameter is safe only if existing handlers ignore parameters they don't know. Handlers in the JavaScript and React SDKs receive the parameters as a single object, so extra keys are ignored unless your code rejects them.

## Pin each frontend release to an agent version

Pin every release, not only the one that introduces a breaking change. A release that starts conversations on the main branch moves to whatever main becomes, including a later merge that removes the tool it handles.

#### Push the agent and record its version

After `agents.push()`, read the agent's current version and write it to a file that ships with the frontend build. Run this in the same deploy job as the push, so that no other push lands in between:

```python
import json

from elevenlabs import ElevenLabs
from elevenlabs.agent_builder import Agent
from elevenlabs.agent_tools import Schema, Tool

AGENT_ID = "agent_7101k5zvyjhmfg983brhmhkd98n6"

elevenlabs = ElevenLabs()

add_to_cart = (
    Tool.client("add_to_cart", "Add a product to the shopper's cart")
    .param("sku", Schema.string().describe("The product SKU, e.g. TSH-0042"))
    .options(expects_response=True)
)

agent = Agent(
    "Kiosk assistant",
    prompt="You help shoppers find products and add them to their cart.",
    tools=[add_to_cart],
)

elevenlabs.conversational_ai.agents.push(agent, agent_id=AGENT_ID)

pushed = elevenlabs.conversational_ai.agents.get(agent_id=AGENT_ID)
with open("web/src/agent-release.json", "w") as f:
    json.dump({"versionId": pushed.version_id}, f)
```

```typescript
import { writeFile } from "node:fs/promises";

import { Agent, ElevenLabsClient, Schema, Tool } from "@elevenlabs/elevenlabs-js";

const AGENT_ID = "agent_7101k5zvyjhmfg983brhmhkd98n6";

const elevenlabs = new ElevenLabsClient();

const addToCart = Tool.client("add_to_cart", "Add a product to the shopper's cart")
  .param("sku", Schema.string().describe("The product SKU, e.g. TSH-0042"))
  .options({ expectsResponse: true });

const agent = new Agent("Kiosk assistant", {
  prompt: "You help shoppers find products and add them to their cart.",
  tools: [addToCart],
});

await elevenlabs.conversationalAi.agents.push(agent, { agentId: AGENT_ID });

const pushed = await elevenlabs.conversationalAi.agents.get(AGENT_ID);
await writeFile("web/src/agent-release.json", JSON.stringify({ versionId: pushed.versionId }));
```

The version ID, such as `agtvrsn_3901k6kz2c4ep8vm7tq5hd1xw9fb`, identifies a fixed snapshot of the agent. Later pushes create new versions and leave this one as it is.

#### Mint conversation tokens for that version

Pin the version on your server, where you create the [conversation token](/docs/eleven-agents/api-reference/conversations/get-webrtc-token) or [signed URL](/docs/eleven-agents/api-reference/conversations/get-signed-url). Both accept `version_id`. The client SDKs accept a `branchId` when they start a session, but not a version ID.

The frontend sends the version it was built with, and the server only accepts versions you have released. Without that check, a client could start a conversation on any version of the agent, including one on an unreleased branch:

```python
import os

from elevenlabs import ElevenLabs

AGENT_ID = "agent_7101k5zvyjhmfg983brhmhkd98n6"
# For example "agtvrsn_3901k6kz2c4ep8vm7tq5hd1xw9fb,agtvrsn_5201k7p4m9wcx3rd8ht2vq6ne1sa"
RELEASED_VERSIONS = set(os.environ["RELEASED_AGENT_VERSIONS"].split(","))

elevenlabs = ElevenLabs()


def conversation_token(version_id: str) -> str:
    if version_id not in RELEASED_VERSIONS:
        raise ValueError(f"Unknown agent version: {version_id}")
    response = elevenlabs.conversational_ai.conversations.get_webrtc_token(
        agent_id=AGENT_ID,
        version_id=version_id,
    )
    return response.token
```

```typescript
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";

const AGENT_ID = "agent_7101k5zvyjhmfg983brhmhkd98n6";
// For example "agtvrsn_3901k6kz2c4ep8vm7tq5hd1xw9fb,agtvrsn_5201k7p4m9wcx3rd8ht2vq6ne1sa"
const RELEASED_VERSIONS = new Set(process.env.RELEASED_AGENT_VERSIONS!.split(","));

const elevenlabs = new ElevenLabsClient();

export async function conversationToken(versionId: string): Promise<string> {
  if (!RELEASED_VERSIONS.has(versionId)) {
    throw new Error(`Unknown agent version: ${versionId}`);
  }
  const { token } = await elevenlabs.conversationalAi.conversations.getWebrtcToken({
    agentId: AGENT_ID,
    versionId,
  });
  return token;
}
```

Keep the agent ID on the server, so that a client can only choose between versions of your agent.

#### Start sessions from the frontend with the token

The frontend sends the version from its build to your server, starts the session with the token it gets back, and registers a handler for each client tool that version uses. `onUnhandledClientToolCall` reports a call the release has no handler for. The SDK already returns an error to the agent for such a call, so the callback only needs to log it:

```tsx
import { useConversation } from "@elevenlabs/react";

import release from "./agent-release.json";
import { cart } from "./cart";

export function useKioskConversation() {
  const conversation = useConversation({
    clientTools: {
      add_to_cart: async ({ sku }: { sku: string }) => {
        cart.add(sku);
        return { items: cart.size };
      },
    },
    onUnhandledClientToolCall: (call) => {
      console.error(`No handler for client tool ${call.tool_name}`);
    },
  });

  async function start() {
    const response = await fetch(
      `/api/conversation-token?version_id=${encodeURIComponent(release.versionId)}`
    );
    const conversationToken = await response.text();
    await conversation.startSession({ conversationToken });
  }

  return { conversation, start };
}
```

Add the release's version to `RELEASED_AGENT_VERSIONS` before you deploy the frontend, and remove a version once no deployed release uses it.

## Ship a breaking change as a new tool

Give the changed tool a new name, push it to a branch, and release a frontend pinned to that branch's version. Releases that are already deployed stay pinned to their own version, which still uses the old tool.

#### Define the tool under a new name

`push()` matches tools by name, so a new name creates a new tool and leaves the old one unchanged. This version of `add_to_cart` adds a required `quantity` parameter:

```python
add_to_cart_v2 = (
    Tool.client("add_to_cart_v2", "Add a product to the shopper's cart")
    .param("sku", Schema.string().describe("The product SKU, e.g. TSH-0042"))
    .param("quantity", Schema.integer().describe("How many to add"))
    .options(expects_response=True)
)

agent = Agent(
    "Kiosk assistant",
    prompt="You help shoppers find products and add them to their cart.",
    tools=[add_to_cart_v2],
)
```

```typescript
const addToCartV2 = Tool.client("add_to_cart_v2", "Add a product to the shopper's cart")
  .param("sku", Schema.string().describe("The product SKU, e.g. TSH-0042"))
  .param("quantity", Schema.integer().describe("How many to add"))
  .options({ expectsResponse: true });

const agent = new Agent("Kiosk assistant", {
  prompt: "You help shoppers find products and add them to their cart.",
  tools: [addToCartV2],
});
```

With the Python `@client_tool` decorator, pass `@client_tool(name="add_to_cart_v2")` to keep the function's name. If the agent's prompt mentions the tool by name, update the prompt as well.

#### Push it to a branch

Create a branch from the main branch's current version and push the agent to it. On the branch, `push()` creates `add_to_cart_v2` and reports `add_to_cart` as `"detached"`. The main branch still uses `add_to_cart`:

```python
main = elevenlabs.conversational_ai.agents.get(agent_id=AGENT_ID)

branch = elevenlabs.conversational_ai.agents.branches.create(
    agent_id=AGENT_ID,
    parent_version_id=main.version_id,
    name="add-to-cart-quantity",
    description="add_to_cart_v2 takes a required quantity",
)

elevenlabs.conversational_ai.agents.push(
    agent,
    agent_id=AGENT_ID,
    branch_id=branch.created_branch_id,
)

pushed = elevenlabs.conversational_ai.agents.get(
    agent_id=AGENT_ID,
    branch_id=branch.created_branch_id,
)
with open("web/src/agent-release.json", "w") as f:
    json.dump({"versionId": pushed.version_id}, f)
```

```typescript
const main = await elevenlabs.conversationalAi.agents.get(AGENT_ID);

const branch = await elevenlabs.conversationalAi.agents.branches.create(AGENT_ID, {
  parentVersionId: main.versionId!,
  name: "add-to-cart-quantity",
  description: "add_to_cart_v2 takes a required quantity",
});

await elevenlabs.conversationalAi.agents.push(agent, {
  agentId: AGENT_ID,
  branchId: branch.createdBranchId,
});

const pushed = await elevenlabs.conversationalAi.agents.get(AGENT_ID, {
  branchId: branch.createdBranchId,
});
await writeFile("web/src/agent-release.json", JSON.stringify({ versionId: pushed.versionId }));
```

Test the branch before you release it. [Test a tool change without affecting production](/docs/eleven-agents/customization/tools/tool-configuration/editing-tools#test-a-tool-change-without-affecting-production) covers running tests against a branch and mocking tools.

#### Release the frontend with the new handler

Register `add_to_cart_v2` in the release built against the branch's version. Add that version to `RELEASED_AGENT_VERSIONS`, then deploy the frontend. Clients that load the new release start conversations on the branch's version, and clients still on the old release keep using `add_to_cart`.

Don't route clients to the new version with a [traffic deployment](/docs/eleven-agents/operate/versioning#deploying-traffic). A deployment splits conversations between branches by conversation ID, not by frontend release, so it would send old clients to a version that calls a tool they can't handle.

#### Merge the branch and retire the old tool

Merge the branch into main when the release is out, so that main, and anything that starts conversations without a pin, uses `add_to_cart_v2`. [Merging branches](/docs/eleven-agents/operate/versioning#merging-branches) covers previewing and running the merge.

Keep the `add_to_cart` tool until no deployed release is pinned to a version that uses it. Those versions reference the tool by ID, so deleting it breaks the releases that still use them. Before you delete it, [check what still uses it](/docs/eleven-agents/customization/tools/tool-configuration/editing-tools#check-what-uses-a-tool-before-editing-it), and remove the old versions from `RELEASED_AGENT_VERSIONS`.

## Check handlers against the agent

In Python, [`tools.check_client_tools()`](/docs/eleven-agents/customization/agents-as-code/tools#define-a-client-tool-from-a-function) compares `@client_tool` functions with the client tools on the agent's main branch. It reports each function the agent has no tool for, and each parameter that differs. Run it with `strict=True` in CI to stop a release whose handlers don't match the agent. The JavaScript SDK has no equivalent yet.

## Next steps

#### [Versioning](/docs/eleven-agents/operate/versioning)

Create branches, merge them and read specific versions

#### [Editing tools safely](/docs/eleven-agents/customization/tools/tool-configuration/editing-tools)

How tool edits interact with branches and versions

#### [Agents as code](/docs/eleven-agents/customization/agents-as-code/agents)

Define an agent and its tools, and push them in one call

#### [Client tools](/docs/eleven-agents/customization/tools/client-tools)

Register client tool handlers in your application