Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Update composio client package to fix authConfig update changes (#2391)

Musthaq Ahamad30550484a134
diff --git a/.changeset/deep-eyes-film.md b/.changeset/deep-eyes-film.md
new file mode 100644
index 000000000..99f8b6772
--- /dev/null
+++ b/.changeset/deep-eyes-film.md
@@ -0,0 +1,5 @@
+---
+'@composio/core': patch
+---
+
+Update client dependencies and auth config update params to be optional
diff --git a/fern/pages/src/changelog/01-14-26-auth-config-patch-semantics.md b/fern/pages/src/changelog/01-14-26-auth-config-patch-semantics.md
new file mode 100644
index 000000000..4fd2e9865
--- /dev/null
+++ b/fern/pages/src/changelog/01-14-26-auth-config-patch-semantics.md
@@ -0,0 +1,189 @@
+# True PATCH Semantics for Auth Config Updates
+
+## Version Information
+
+### TypeScript/JavaScript
+- Package: `@composio/core` and provider packages
+- Version: `0.5.1`+
+
+### Python
+- Package: `composio-core` and provider packages
+- Version: `0.10.7`+
+
+---
+
+The `PATCH /api/v3/auth_configs/{id}` endpoint now implements proper partial update semantics. Previously, omitting fields would clear them (behaving like PUT). Now, omitted fields are preserved—only explicitly provided fields are modified.
+
+<Warning>
+**Breaking Change**: If you relied on omitting fields to clear them, you must now explicitly send `null` or `[]`. See [Migration Guide](#migration-guide) below.
+</Warning>
+
+## What Changed
+
+| Field | Before (Buggy) | After (Correct) |
+| ----------------------------- | ------------------------ | --------------------------------- |
+| `credentials` | Required on every update | Optional—merged with existing |
+| `tool_access_config` | Reset to `{}` if omitted | Preserved if omitted |
+| `scopes` (type: default) | Cleared if omitted | Preserved if omitted |
+| `restrict_to_following_tools` | Reset to `[]` if omitted | Preserved if omitted |
+
+<Note>
+**Merge Behavior**: The `credentials` object is merged—send only the fields you want to change, and existing fields are preserved.
+</Note>
+
+## New Capabilities
+
+### Rotate a Single Credential Field
+
+Update just `client_secret` without resending `client_id` or other fields:
+
+<CodeBlocks>
+```python title="Python SDK"
+from composio import Composio
+
+composio = Composio()
+
+# Only send the field you want to update - other credentials are preserved
+
+composio.auth_configs.update(
+"ac_yourAuthConfigId",
+options={
+"type": "custom",
+"credentials": {
+"client_secret": "new_rotated_secret",
+},
+},
+)
+
+````
+
+```typescript title="TypeScript SDK"
+import { Composio } from "@composio/core";
+
+const composio = new Composio();
+
+// Only send the field you want to update - other credentials are preserved
+await composio.authConfigs.update("ac_yourAuthConfigId", {
+ type: "custom",
+ credentials: {
+ client_secret: "new_rotated_secret",
+ },
+});
+````
+
+</CodeBlocks>
+
+### Update Tool Restrictions Without Touching Credentials
+
+Previously, this would fail because `credentials` was required. Now it works:
+
+<CodeBlocks>
+```python title="Python SDK"
+from composio import Composio
+
+composio = Composio()
+
+# Update tool restrictions - credentials are automatically preserved
+
+composio.auth_configs.update(
+"ac_yourAuthConfigId",
+options={
+"type": "custom",
+"tool_access_config": {
+"tools_available_for_execution": ["GMAIL_SEND_EMAIL", "GMAIL_READ_EMAIL"],
+},
+},
+)
+
+````
+
+```typescript title="TypeScript SDK"
+import { Composio } from "@composio/core";
+
+const composio = new Composio();
+
+// Note: TypeScript SDK currently requires credentials for custom type updates
+await composio.authConfigs.update("ac_yourAuthConfigId", {
+ type: "custom",
+ credentials: {
+ // Include existing credentials when using TS SDK
+ },
+ toolAccessConfig: {
+ toolsAvailableForExecution: ["GMAIL_SEND_EMAIL", "GMAIL_READ_EMAIL"],
+ },
+});
+````
+
+</CodeBlocks>
+
+## Migration Guide
+
+### Am I Affected?
+
+**Yes**, if your code relied on omitting fields to clear them.
+
+**No**, if you always send complete payloads or only use PATCH to update specific fields.
+
+### How to Clear Fields Explicitly
+
+| To Clear | Python SDK | TypeScript SDK |
+| -------------------- | ------------------------------------------------------------- | ------------------------------------------------------ |
+| `tool_access_config` | `"tool_access_config": {"tools_available_for_execution": []}` | `toolAccessConfig: { toolsAvailableForExecution: [] }` |
+| `scopes` (default) | `"scopes": ""` | `scopes: ""` (via HTTP API) |
+
+<CodeBlocks>
+```python title="Python SDK - Clear tool restrictions"
+from composio import Composio
+
+composio = Composio()
+
+# Explicitly clear tool restrictions with empty array
+
+composio.auth_configs.update(
+"ac_yourAuthConfigId",
+options={
+"type": "custom",
+"tool_access_config": {
+"tools_available_for_execution": [],
+},
+},
+)
+
+````
+
+```typescript title="TypeScript SDK - Clear tool restrictions"
+import { Composio } from "@composio/core";
+
+const composio = new Composio();
+
+// Explicitly clear tool restrictions with empty array
+await composio.authConfigs.update("ac_yourAuthConfigId", {
+ type: "custom",
+ credentials: {
+ // Include existing credentials when using TS SDK
+ },
+ toolAccessConfig: {
+ toolsAvailableForExecution: [],
+ },
+});
+````
+
+</CodeBlocks>
+
+### Raw HTTP API
+
+For users calling the API directly:
+
+```bash
+# Rotate single credential
+curl -X PATCH "https://backend.composio.dev/api/v3/auth_configs/{id}" \
+ -H "x-api-key: YOUR_API_KEY" \
+ -H "Content-Type: application/json" \
+ -d '{"type": "custom", "credentials": {"client_secret": "new_secret"}}'
+
+# Clear tool restrictions
+curl -X PATCH "https://backend.composio.dev/api/v3/auth_configs/{id}" \
+ -H "x-api-key: YOUR_API_KEY" \
+ -H "Content-Type: application/json" \
+ -d '{"type": "custom", "tool_access_config": {"tools_available_for_execution": []}}'
+```
diff --git a/fern/pyproject.toml b/fern/pyproject.toml
index cc3b6cf1d..417e1a7f4 100644
--- a/fern/pyproject.toml
+++ b/fern/pyproject.toml
@@ -10,7 +10,7 @@ dependencies = [
"click>=8.1.7",
"ruamel-yaml>=0.18.10",
"typing-extensions>=4.13.0",
- "composio-client==1.25.0",
+ "composio-client==1.26.0",
"openai>=1.79.0",
"composio==1.0.0rc5",
# Dependencies for SDK doc generation
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 1dd552ab5..7d59d77e5 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -16,8 +16,8 @@ catalogs:
specifier: ^4.20250917.0
version: 4.20250917.0
'@composio/client':
- specifier: 0.1.0-alpha.54
- version: 0.1.0-alpha.54
+ specifier: 0.1.0-alpha.55
+ version: 0.1.0-alpha.55
'@modelcontextprotocol/sdk':
specifier: ^1.24.0
version: 1.24.1
@@ -882,7 +882,7 @@ importers:
version: 1.0.0-alpha.1
'@composio/client':
specifier: 'catalog:'
- version: 0.1.0-alpha.54
+ version: 0.1.0-alpha.55
'@composio/core':
specifier: workspace:*
version: link:../core
@@ -976,7 +976,7 @@ importers:
dependencies:
'@composio/client':
specifier: 'catalog:'
- version: 0.1.0-alpha.54
+ version: 0.1.0-alpha.55
'@composio/json-schema-to-zod':
specifier: workspace:*
version: link:../json-schema-to-zod
@@ -1712,8 +1712,8 @@ packages:
resolution: {integrity: sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==}
engines: {node: '>=0.1.90'}
- '@composio/[email protected]':
- resolution: {integrity: sha512-3whr4XjaMQUTcxmkaePMPeISUEE3NDRmGaf6lHReS9M2t6jiQbuZT3OktBvvw9QHrH+AZPXgaDoH65Hlr4qGWA==}
+ '@composio/[email protected]':
+ resolution: {integrity: sha512-nINJ2bgqZi+eyNSPSd1p9hc7CryXqYonlhJqaw6U9gUeLYBq27ASpIM3ddi61j+6U6+ZKeaX1FmO3hcJwH4wCw==}
'@composio/[email protected]':
resolution: {integrity: sha512-IpbfST0SSs/CEv+PIf6+EL0feNuJhQyUrOHJLPge8NhyLLrCyVqvujRIPyRUUjy0NDsked/Mm5VpJmYM6OACbg==}
@@ -7835,7 +7835,7 @@ snapshots:
dependencies:
'@ai-sdk/provider': 2.0.0
'@ai-sdk/provider-utils': 3.0.10([email protected])
- '@vercel/oidc': 3.0.5
+ '@vercel/oidc': 3.1.0
zod: 4.3.5
@@ -8439,7 +8439,7 @@ snapshots:
'@colors/[email protected]':
optional: true
- '@composio/[email protected]': {}
+ '@composio/[email protected]': {}
'@composio/[email protected]': {}
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index b09a7976a..f5888ca43 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -18,7 +18,7 @@ catalog:
'@arethetypeswrong/cli': ^0.18.2
'@cloudflare/vitest-pool-workers': ^0.9.2
'@cloudflare/workers-types': ^4.20250917.0
- '@composio/client': 0.1.0-alpha.54
+ '@composio/client': 0.1.0-alpha.55
'@modelcontextprotocol/sdk': ^1.24.0
ai: ^6.0.3
openai: ^5.20.3
diff --git a/python/composio/core/models/auth_configs.py b/python/composio/core/models/auth_configs.py
index c941e24e7..5089f4d85 100644
--- a/python/composio/core/models/auth_configs.py
+++ b/python/composio/core/models/auth_configs.py
@@ -95,6 +95,9 @@ class AuthConfigs(Resource):
nanoid=nanoid,
type=options["type"], # type: ignore
credentials=options.get("credentials", self._client.not_given),
+ is_enabled_for_tool_router=options.get(
+ "is_enabled_for_tool_router", self._client.not_given
+ ),
tool_access_config=options.get(
"tool_access_config", self._client.not_given
),
diff --git a/python/composio/core/models/custom_tools.py b/python/composio/core/models/custom_tools.py
index 6149720e5..d4dc74cf4 100644
--- a/python/composio/core/models/custom_tools.py
+++ b/python/composio/core/models/custom_tools.py
@@ -91,6 +91,7 @@ class CustomTool:
version="1.0.0",
scopes=[],
slug=self.slug,
+ status="active",
toolkit=tool_list_response.ItemToolkit(
logo="",
name=self.toolkit or "custom",
diff --git a/python/providers/anthropic/pyproject.toml b/python/providers/anthropic/pyproject.toml
index f8cea10f5..7daa43288 100644
--- a/python/providers/anthropic/pyproject.toml
+++ b/python/providers/anthropic/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "composio-anthropic"
-version = "0.10.6"
+version = "0.10.7"
description = "Use Composio to get an array of tools with your Anthropic LLMs."
readme = "README.md"
requires-python = ">=3.10,<4"
diff --git a/python/providers/anthropic/setup.py b/python/providers/anthropic/setup.py
index 3fd7e2cc0..c7f398a4e 100644
--- a/python/providers/anthropic/setup.py
+++ b/python/providers/anthropic/setup.py
@@ -8,7 +8,7 @@ from setuptools import setup
setup(
name="composio_anthropic",
- version="0.10.6",
+ version="0.10.7",
author="Composio",
author_email="[email protected]",
description="Use Composio to get an array of tools with your Anthropic LLMs.",
diff --git a/python/providers/autogen/pyproject.toml b/python/providers/autogen/pyproject.toml
index eec3ba041..65b29b63c 100644
--- a/python/providers/autogen/pyproject.toml
+++ b/python/providers/autogen/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "composio-autogen"
-version = "0.10.6"
+version = "0.10.7"
description = "Use Composio to get an array of tools with your autogen agent."
readme = "README.md"
requires-python = ">=3.9,<4"
diff --git a/python/providers/autogen/setup.py b/python/providers/autogen/setup.py
index 59acf1305..d6dbdcdcd 100644
--- a/python/providers/autogen/setup.py
+++ b/python/providers/autogen/setup.py
@@ -8,7 +8,7 @@ from setuptools import setup
setup(
name="composio_autogen",
- version="0.10.6",
+ version="0.10.7",
author="Composio",
author_email="[email protected]",
description="Use Composio to get an array of tools with your Autogen agent.",
diff --git a/python/providers/claude_agent_sdk/pyproject.toml b/python/providers/claude_agent_sdk/pyproject.toml
index 7d8443931..2bdef9061 100644
--- a/python/providers/claude_agent_sdk/pyproject.toml
+++ b/python/providers/claude_agent_sdk/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "composio-claude-agent-sdk"
-version = "0.10.6"
+version = "0.10.7"
description = "Use Composio to get an array of tools with Claude Code Agents SDK."
readme = "README.md"
requires-python = ">=3.10,<4"
diff --git a/python/providers/claude_agent_sdk/setup.py b/python/providers/claude_agent_sdk/setup.py
index 47c955707..7f4a3adba 100644
--- a/python/providers/claude_agent_sdk/setup.py
+++ b/python/providers/claude_agent_sdk/setup.py
@@ -8,7 +8,7 @@ from setuptools import find_packages, setup
setup(
name="composio_claude_agent_sdk",
- version="0.10.6",
+ version="0.10.7",
author="Composio",
author_email="[email protected]",
description="Use Composio to get array of tools for Claude Agent SDK",
diff --git a/python/providers/crewai/pyproject.toml b/python/providers/crewai/pyproject.toml
index c21923a0e..a433dcaeb 100644
--- a/python/providers/crewai/pyproject.toml
+++ b/python/providers/crewai/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "composio-crewai"
-version = "0.10.6"
+version = "0.10.7"
description = "Use Composio to get an array of tools with your CrewAI agent."
readme = "README.md"
requires-python = ">=3.9,<4"
diff --git a/python/providers/crewai/setup.py b/python/providers/crewai/setup.py
index c396556cf..63eb66648 100644
--- a/python/providers/crewai/setup.py
+++ b/python/providers/crewai/setup.py
@@ -6,7 +6,7 @@ from setuptools import setup
setup(
name="composio_crewai",
- version="0.10.6",
+ version="0.10.7",
author="Composio",
author_email="[email protected]",
description="Use Composio to get an array of tools with your CrewAI agent.",
diff --git a/python/providers/gemini/pyproject.toml b/python/providers/gemini/pyproject.toml
index 8caf230ef..be032978a 100644
--- a/python/providers/gemini/pyproject.toml
+++ b/python/providers/gemini/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "composio-gemini"
-version = "0.10.6"
+version = "0.10.7"
description = "Use Composio to get an array of tools with your Gemini agent."
readme = "README.md"
requires-python = ">=3.9,<4"
diff --git a/python/providers/gemini/setup.py b/python/providers/gemini/setup.py
index 44781edd1..ebe9aa9eb 100644
--- a/python/providers/gemini/setup.py
+++ b/python/providers/gemini/setup.py
@@ -8,7 +8,7 @@ from setuptools import setup
setup(
name="composio_gemini",
- version="0.10.6",
+ version="0.10.7",
author="Composio",
author_email="[email protected]",
description="Use Composio to get an array of tools with your Gemini agent.",
diff --git a/python/providers/google/pyproject.toml b/python/providers/google/pyproject.toml
index b862c1e9f..90f554883 100644
--- a/python/providers/google/pyproject.toml
+++ b/python/providers/google/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "composio-google"
-version = "0.10.6"
+version = "0.10.7"
description = "Use Composio to get an array of tools with your Google AI Python Gemini model."
readme = "README.md"
requires-python = ">=3.9,<4"
diff --git a/python/providers/google/setup.py b/python/providers/google/setup.py
index 8b67149e0..415b0b99d 100644
--- a/python/providers/google/setup.py
+++ b/python/providers/google/setup.py
@@ -8,7 +8,7 @@ from setuptools import setup
setup(
name="composio_google",
- version="0.10.6",
+ version="0.10.7",
author="Composio",
author_email="[email protected]",
description="Use Composio to get an array of tools with your Google AI Python Gemini model.",
diff --git a/python/providers/google_adk/pyproject.toml b/python/providers/google_adk/pyproject.toml
index 04e847395..3a0b173c8 100644
--- a/python/providers/google_adk/pyproject.toml
+++ b/python/providers/google_adk/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "composio-google-adk"
-version = "0.10.6"
+version = "0.10.7"
description = "Use Composio to get an array of tools with your Google AI Python Gemini model."
readme = "README.md"
requires-python = ">=3.9,<4"
diff --git a/python/providers/google_adk/setup.py b/python/providers/google_adk/setup.py
index 7074e4536..807c4b920 100644
--- a/python/providers/google_adk/setup.py
+++ b/python/providers/google_adk/setup.py
@@ -8,7 +8,7 @@ from setuptools import setup
setup(
name="composio_google_adk",
- version="0.10.6",
+ version="0.10.7",
author="Composio",
author_email="[email protected]",
description="Use Composio to get an array of tools with your Google AI Python Gemini model.",
diff --git a/python/providers/langchain/pyproject.toml b/python/providers/langchain/pyproject.toml
index 23b80146b..ee7107eed 100644
--- a/python/providers/langchain/pyproject.toml
+++ b/python/providers/langchain/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "composio-langchain"
-version = "0.10.6"
+version = "0.10.7"
description = "Use Composio to get an array of tools with your Langchain agent."
readme = "README.md"
requires-python = ">=3.9,<4"
diff --git a/python/providers/langchain/setup.py b/python/providers/langchain/setup.py
index a488caac8..6d37e83ce 100644
--- a/python/providers/langchain/setup.py
+++ b/python/providers/langchain/setup.py
@@ -8,7 +8,7 @@ from setuptools import setup
setup(
name="composio_langchain",
- version="0.10.6",
+ version="0.10.7",
author="composio",
author_email="[email protected]",
description="Use Composio to get an array of tools with your Langchain agent.",
diff --git a/python/providers/langgraph/pyproject.toml b/python/providers/langgraph/pyproject.toml
index a244a8785..acb777faf 100644
--- a/python/providers/langgraph/pyproject.toml
+++ b/python/providers/langgraph/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "composio-langgraph"
-version = "0.10.6"
+version = "0.10.7"
description = "Use Composio to get array of tools with LangGraph Agent Workflows."
readme = "README.md"
requires-python = ">=3.9,<4"
diff --git a/python/providers/langgraph/setup.py b/python/providers/langgraph/setup.py
index a56d79aca..28b32e55f 100644
--- a/python/providers/langgraph/setup.py
+++ b/python/providers/langgraph/setup.py
@@ -8,7 +8,7 @@ from setuptools import setup
setup(
name="composio_langgraph",
- version="0.10.6",
+ version="0.10.7",
author="composio",
author_email="[email protected]",
description="Use Composio to get array of tools with LangGraph Agent Workflows",
diff --git a/python/providers/llamaindex/pyproject.toml b/python/providers/llamaindex/pyproject.toml
index f93b4b0e8..e309f2b8d 100644
--- a/python/providers/llamaindex/pyproject.toml
+++ b/python/providers/llamaindex/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "composio-llamaindex"
-version = "0.10.6"
+version = "0.10.7"
description = "Use Composio to get array of tools with LlamaIndex Agent Workflows."
readme = "README.md"
requires-python = ">=3.9,<4"
diff --git a/python/providers/llamaindex/setup.py b/python/providers/llamaindex/setup.py
index 424004989..694ce9ec1 100644
--- a/python/providers/llamaindex/setup.py
+++ b/python/providers/llamaindex/setup.py
@@ -8,7 +8,7 @@ from setuptools import setup
setup(
name="composio_llamaindex",
- version="0.10.6",
+ version="0.10.7",
author="composio",
author_email="[email protected]",
description="Use Composio to get array of tools with LlamaIndex Agent Workflows",
diff --git a/python/providers/openai/pyproject.toml b/python/providers/openai/pyproject.toml
index f916da527..4391fc544 100644
--- a/python/providers/openai/pyproject.toml
+++ b/python/providers/openai/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "composio-openai"
-version = "0.10.6"
+version = "0.10.7"
description = "Use Composio to get an array of tools with your OpenAI Function Call."
readme = "README.md"
requires-python = ">=3.9,<4"
diff --git a/python/providers/openai/setup.py b/python/providers/openai/setup.py
index 151586a6b..74c6993ce 100644
--- a/python/providers/openai/setup.py
+++ b/python/providers/openai/setup.py
@@ -8,7 +8,7 @@ from setuptools import setup
setup(
name="composio_openai",
- version="0.10.6",
+ version="0.10.7",
author="Composio",
author_email="[email protected]",
description="Use Composio to get an array of tools with your OpenAI Function Call.",
diff --git a/python/providers/openai_agents/pyproject.toml b/python/providers/openai_agents/pyproject.toml
index 4ff7da231..fa2842276 100644
--- a/python/providers/openai_agents/pyproject.toml
+++ b/python/providers/openai_agents/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "composio-openai-agents"
-version = "0.10.6"
+version = "0.10.7"
description = "Use Composio to get array of strongly typed tools for OpenAI Agents"
readme = "README.md"
requires-python = ">=3.9,<4"
diff --git a/python/providers/openai_agents/setup.py b/python/providers/openai_agents/setup.py
index a34ab419f..959567f6e 100644
--- a/python/providers/openai_agents/setup.py
+++ b/python/providers/openai_agents/setup.py
@@ -8,7 +8,7 @@ from setuptools import find_packages, setup
setup(
name="composio_openai_agents",
- version="0.10.6",
+ version="0.10.7",
author="Composio",
author_email="[email protected]",
description="Use Composio to get array of strongly typed tools for OpenAI Agents",
diff --git a/python/pyproject.toml b/python/pyproject.toml
index 67d1ce5f9..84992fa9f 100644
--- a/python/pyproject.toml
+++ b/python/pyproject.toml
@@ -1,13 +1,13 @@
[project]
name = "composio"
-version = "0.10.6"
+version = "0.10.7"
description = "SDK for integrating Composio with your applications."
readme = "README.md"
requires-python = ">=3.10,<4"
dependencies = [
"pysher>=1.0.8",
"pydantic>=2.6.4",
- "composio-client==1.25.0",
+ "composio-client==1.26.0",
"typing-extensions>=4.0.0",
"openai",
]
diff --git a/python/setup.py b/python/setup.py
index 3485a408d..a37f1d911 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -25,7 +25,7 @@ setup(
install_requires=[
"pysher==1.0.8",
"pydantic>=2.6.4",
- "composio-client==1.25.0",
+ "composio-client==1.26.0",
"typing-extensions>=4.0.0",
],
include_package_data=True,
diff --git a/python/tests/test_auth_configs.py b/python/tests/test_auth_configs.py
new file mode 100644
index 000000000..3129d98da
--- /dev/null
+++ b/python/tests/test_auth_configs.py
@@ -0,0 +1,589 @@
+"""Tests for auth configs management."""
+
+import pytest
+from unittest.mock import Mock
+
+from composio.core.models.auth_configs import AuthConfigs
+from composio.client.types import (
+ auth_config_list_response,
+ auth_config_create_response,
+ auth_config_retrieve_response,
+)
+
+
+class TestAuthConfigs:
+ """Test suite for AuthConfigs class."""
+
+ @pytest.fixture
+ def mock_client(self):
+ """Create a mock client for testing."""
+ client = Mock()
+ client.auth_configs = Mock()
+ client.auth_configs.list = Mock()
+ client.auth_configs.create = Mock()
+ client.auth_configs.retrieve = Mock()
+ client.auth_configs.update = Mock()
+ client.auth_configs.delete = Mock()
+ client.auth_configs.update_status = Mock()
+ client.not_given = object() # Sentinel value for optional params
+ return client
+
+ @pytest.fixture
+ def auth_configs(self, mock_client):
+ """Create an AuthConfigs instance with mock client."""
+ return AuthConfigs(client=mock_client)
+
+ @pytest.fixture
+ def mock_auth_config_response(self):
+ """Mock auth config retrieve response."""
+ response = Mock(spec=auth_config_retrieve_response.AuthConfigRetrieveResponse)
+ response.id = "auth_12345"
+ response.name = "Test Auth Config"
+ response.no_of_connections = 5
+ response.status = "ENABLED"
+ response.toolkit = Mock()
+ response.toolkit.logo = "https://example.com/logo.png"
+ response.toolkit.slug = "github"
+ response.uuid = "uuid-12345"
+ response.auth_scheme = "OAUTH2"
+ response.credentials = {
+ "client_id": "test_client_id",
+ "client_secret": "test_client_secret",
+ }
+ response.expected_input_fields = [
+ {"name": "client_id", "type": "string"},
+ {"name": "client_secret", "type": "string"},
+ ]
+ response.is_composio_managed = True
+ response.created_by = "user_123"
+ response.created_at = "2023-01-01T00:00:00Z"
+ response.last_updated_at = "2023-01-01T00:00:00Z"
+ return response
+
+ def test_constructor_creates_instance(self, auth_configs, mock_client):
+ """Test that AuthConfigs instance is created successfully."""
+ assert isinstance(auth_configs, AuthConfigs)
+ assert auth_configs._client is mock_client
+
+ # List tests
+ def test_list_without_params(self, auth_configs, mock_client):
+ """Test listing auth configs without query parameters."""
+ mock_response = Mock(spec=auth_config_list_response.AuthConfigListResponse)
+ mock_response.items = []
+ mock_response.next_cursor = None
+ mock_response.total_pages = 0
+ mock_client.auth_configs.list.return_value = mock_response
+
+ result = auth_configs.list()
+
+ mock_client.auth_configs.list.assert_called_once_with()
+ assert result == mock_response
+
+ def test_list_with_params(self, auth_configs, mock_client):
+ """Test listing auth configs with query parameters."""
+ mock_response = Mock(spec=auth_config_list_response.AuthConfigListResponse)
+ mock_response.items = []
+ mock_client.auth_configs.list.return_value = mock_response
+
+ result = auth_configs.list(
+ cursor="cursor_123",
+ is_composio_managed=True,
+ limit=10,
+ toolkit_slug="github",
+ )
+
+ mock_client.auth_configs.list.assert_called_once_with(
+ cursor="cursor_123",
+ is_composio_managed=True,
+ limit=10,
+ toolkit_slug="github",
+ )
+ assert result == mock_response
+
+ def test_list_with_empty_result(self, auth_configs, mock_client):
+ """Test listing auth configs returns empty list."""
+ mock_response = Mock(spec=auth_config_list_response.AuthConfigListResponse)
+ mock_response.items = []
+ mock_response.next_cursor = None
+ mock_response.total_pages = 0
+ mock_client.auth_configs.list.return_value = mock_response
+
+ result = auth_configs.list()
+
+ assert len(result.items) == 0
+ assert result.next_cursor is None
+ assert result.total_pages == 0
+
+ # Create tests
+ def test_create_with_default_composio_managed_auth(self, auth_configs, mock_client):
+ """Test creating auth config with default Composio managed type."""
+ mock_auth_config = Mock(spec=auth_config_create_response.AuthConfig)
+ mock_auth_config.id = "auth_12345"
+ mock_auth_config.auth_scheme = "OAUTH2"
+ mock_auth_config.is_composio_managed = True
+
+ mock_response = Mock(spec=auth_config_create_response.AuthConfigCreateResponse)
+ mock_response.auth_config = mock_auth_config
+
+ mock_client.auth_configs.create.return_value = mock_response
+
+ options = {
+ "type": "use_composio_managed_auth",
+ "name": "My GitHub Config",
+ }
+
+ result = auth_configs.create("github", options)
+
+ mock_client.auth_configs.create.assert_called_once()
+ call_args = mock_client.auth_configs.create.call_args
+ assert call_args.kwargs["toolkit"] == {"slug": "github"}
+ assert call_args.kwargs["auth_config"] == options
+ assert result == mock_auth_config
+
+ def test_create_with_custom_auth_and_credentials(self, auth_configs, mock_client):
+ """Test creating custom auth config with credentials."""
+ mock_auth_config = Mock(spec=auth_config_create_response.AuthConfig)
+ mock_auth_config.id = "auth_12345"
+ mock_auth_config.auth_scheme = "OAUTH2"
+ mock_auth_config.is_composio_managed = False
+
+ mock_response = Mock(spec=auth_config_create_response.AuthConfigCreateResponse)
+ mock_response.auth_config = mock_auth_config
+
+ mock_client.auth_configs.create.return_value = mock_response
+
+ options = {
+ "type": "use_custom_auth",
+ "name": "Custom GitHub Auth",
+ "auth_scheme": "OAUTH2",
+ "credentials": {
+ "client_id": "test_client_id",
+ "client_secret": "test_client_secret",
+ },
+ }
+
+ result = auth_configs.create("github", options)
+
+ mock_client.auth_configs.create.assert_called_once()
+ call_args = mock_client.auth_configs.create.call_args
+ assert call_args.kwargs["toolkit"] == {"slug": "github"}
+ assert call_args.kwargs["auth_config"] == options
+ assert result.is_composio_managed is False
+ assert result.auth_scheme == "OAUTH2"
+
+ def test_create_with_tool_access_config(self, auth_configs, mock_client):
+ """Test creating auth config with tool access configuration."""
+ mock_auth_config = Mock(spec=auth_config_create_response.AuthConfig)
+ mock_auth_config.id = "auth_12345"
+
+ mock_response = Mock(spec=auth_config_create_response.AuthConfigCreateResponse)
+ mock_response.auth_config = mock_auth_config
+
+ mock_client.auth_configs.create.return_value = mock_response
+
+ options = {
+ "type": "use_composio_managed_auth",
+ "name": "Config with Tool Access",
+ "tool_access_config": {
+ "tools_for_connected_account_creation": ["GITHUB_CREATE_ISSUE"]
+ },
+ }
+
+ result = auth_configs.create("github", options)
+
+ mock_client.auth_configs.create.assert_called_once()
+ assert result == mock_auth_config
+
+ # Get tests
+ def test_get_retrieves_auth_config_by_id(
+ self, auth_configs, mock_client, mock_auth_config_response
+ ):
+ """Test retrieving auth config by ID."""
+ mock_client.auth_configs.retrieve.return_value = mock_auth_config_response
+
+ result = auth_configs.get("auth_12345")
+
+ mock_client.auth_configs.retrieve.assert_called_once_with("auth_12345")
+ assert result == mock_auth_config_response
+ assert result.id == "auth_12345"
+ assert result.name == "Test Auth Config"
+
+ def test_get_handles_not_found_error(self, auth_configs, mock_client):
+ """Test get handles API error when auth config not found."""
+ mock_client.auth_configs.retrieve.side_effect = Exception(
+ "Auth config not found"
+ )
+
+ with pytest.raises(Exception) as exc_info:
+ auth_configs.get("nonexistent_auth")
+
+ assert "Auth config not found" in str(exc_info.value)
+
+ def test_get_with_is_enabled_for_tool_router_true(
+ self, auth_configs, mock_client, mock_auth_config_response
+ ):
+ """Test retrieving auth config with isEnabledForToolRouter set to true."""
+ mock_auth_config_response.is_enabled_for_tool_router = True
+ mock_client.auth_configs.retrieve.return_value = mock_auth_config_response
+
+ result = auth_configs.get("auth_12345")
+
+ assert hasattr(result, "is_enabled_for_tool_router")
+ assert result.is_enabled_for_tool_router is True
+
+ def test_get_with_is_enabled_for_tool_router_false(
+ self, auth_configs, mock_client, mock_auth_config_response
+ ):
+ """Test retrieving auth config with isEnabledForToolRouter set to false."""
+ mock_auth_config_response.is_enabled_for_tool_router = False
+ mock_client.auth_configs.retrieve.return_value = mock_auth_config_response
+
+ result = auth_configs.get("auth_12345")
+
+ assert hasattr(result, "is_enabled_for_tool_router")
+ assert result.is_enabled_for_tool_router is False
+
+ def test_get_with_is_enabled_for_tool_router_undefined(
+ self, auth_configs, mock_client, mock_auth_config_response
+ ):
+ """Test retrieving auth config with isEnabledForToolRouter undefined."""
+ # Don't set the attribute at all to simulate undefined
+ if hasattr(mock_auth_config_response, "is_enabled_for_tool_router"):
+ delattr(mock_auth_config_response, "is_enabled_for_tool_router")
+ mock_client.auth_configs.retrieve.return_value = mock_auth_config_response
+
+ result = auth_configs.get("auth_12345")
+
+ # Should not have the attribute or it should be None
+ assert (
+ not hasattr(result, "is_enabled_for_tool_router")
+ or result.is_enabled_for_tool_router is None
+ )
+
+ # Update tests
+ def test_update_custom_auth_config_with_credentials(
+ self, auth_configs, mock_client
+ ):
+ """Test updating custom auth config with credentials."""
+ mock_response = {"id": "auth_12345", "status": "success"}
+ mock_client.auth_configs.update.return_value = mock_response
+
+ options = {
+ "type": "custom",
+ "credentials": {
+ "client_id": "new_client_id",
+ "client_secret": "new_client_secret",
+ },
+ }
+
+ result = auth_configs.update("auth_12345", options=options)
+
+ mock_client.auth_configs.update.assert_called_once()
+ call_args = mock_client.auth_configs.update.call_args
+ assert call_args.kwargs["nanoid"] == "auth_12345"
+ assert call_args.kwargs["type"] == "custom"
+ assert call_args.kwargs["credentials"] == options["credentials"]
+ assert result == mock_response
+
+ def test_update_default_auth_config_with_scopes(self, auth_configs, mock_client):
+ """Test updating default auth config with scopes."""
+ mock_response = {"id": "auth_12345", "status": "success"}
+ mock_client.auth_configs.update.return_value = mock_response
+
+ options = {
+ "type": "default",
+ "scopes": "read:user,repo",
+ }
+
+ result = auth_configs.update("auth_12345", options=options)
+
+ mock_client.auth_configs.update.assert_called_once()
+ # Check that scopes are not directly passed but other fields are
+ call_args = mock_client.auth_configs.update.call_args
+ assert call_args.kwargs["nanoid"] == "auth_12345"
+ assert call_args.kwargs["type"] == "default"
+ assert result == mock_response
+
+ def test_update_with_is_enabled_for_tool_router(self, auth_configs, mock_client):
+ """Test updating auth config with isEnabledForToolRouter."""
+ mock_response = {"id": "auth_12345", "status": "success"}
+ mock_client.auth_configs.update.return_value = mock_response
+
+ options = {
+ "type": "custom",
+ "credentials": {"api_key": "new_key"},
+ "is_enabled_for_tool_router": True,
+ }
+
+ result = auth_configs.update("auth_12345", options=options)
+
+ call_args = mock_client.auth_configs.update.call_args
+ assert call_args.kwargs["is_enabled_for_tool_router"] is True
+ assert result == mock_response
+
+ def test_update_with_tool_access_config(self, auth_configs, mock_client):
+ """Test updating auth config with tool access configuration."""
+ mock_response = {"id": "auth_12345", "status": "success"}
+ mock_client.auth_configs.update.return_value = mock_response
+
+ options = {
+ "type": "custom",
+ "credentials": {"api_key": "new_key"},
+ "tool_access_config": {
+ "tools_for_connected_account_creation": ["GITHUB_CREATE_ISSUE"]
+ },
+ }
+
+ result = auth_configs.update("auth_12345", options=options)
+
+ call_args = mock_client.auth_configs.update.call_args
+ assert call_args.kwargs["tool_access_config"] == options["tool_access_config"]
+ assert result == mock_response
+
+ def test_update_with_large_credential_object(self, auth_configs, mock_client):
+ """Test updating auth config with large credential object."""
+ mock_response = {"id": "auth_12345", "status": "success"}
+ mock_client.auth_configs.update.return_value = mock_response
+
+ large_credentials = {
+ "field1": "value1",
+ "field2": "value2",
+ "field3": {"nested": "object"},
+ "field4": ["array", "values"],
+ "field5": 12345,
+ "field6": True,
+ }
+
+ options = {
+ "type": "custom",
+ "credentials": large_credentials,
+ }
+
+ result = auth_configs.update("auth_12345", options=options)
+
+ call_args = mock_client.auth_configs.update.call_args
+ assert call_args.kwargs["credentials"] == large_credentials
+ assert result == mock_response
+
+ def test_update_handles_api_error(self, auth_configs, mock_client):
+ """Test update handles API errors."""
+ mock_client.auth_configs.update.side_effect = Exception("Update failed")
+
+ options = {
+ "type": "custom",
+ "credentials": {"api_key": "key"},
+ }
+
+ with pytest.raises(Exception) as exc_info:
+ auth_configs.update("auth_12345", options=options)
+
+ assert "Update failed" in str(exc_info.value)
+
+ # Delete tests
+ def test_delete_auth_config_by_id(self, auth_configs, mock_client):
+ """Test deleting auth config by ID."""
+ mock_response = {"id": "auth_12345", "status": "deleted"}
+ mock_client.auth_configs.delete.return_value = mock_response
+
+ result = auth_configs.delete("auth_12345")
+
+ mock_client.auth_configs.delete.assert_called_once_with("auth_12345")
+ assert result == mock_response
+
+ def test_delete_handles_api_error(self, auth_configs, mock_client):
+ """Test delete handles API errors."""
+ mock_client.auth_configs.delete.side_effect = Exception("Delete failed")
+
+ with pytest.raises(Exception) as exc_info:
+ auth_configs.delete("auth_12345")
+
+ assert "Delete failed" in str(exc_info.value)
+
+ # Enable/Disable tests
+ def test_enable_auth_config(self, auth_configs, mock_client):
+ """Test enabling auth config."""
+ mock_response = {"id": "auth_12345", "status": "ENABLED"}
+ mock_client.auth_configs.update_status.return_value = mock_response
+
+ result = auth_configs.enable("auth_12345")
+
+ mock_client.auth_configs.update_status.assert_called_once_with(
+ "ENABLED", nanoid="auth_12345"
+ )
+ assert result == mock_response
+
+ def test_disable_auth_config(self, auth_configs, mock_client):
+ """Test disabling auth config."""
+ mock_response = {"id": "auth_12345", "status": "DISABLED"}
+ mock_client.auth_configs.update_status.return_value = mock_response
+
+ result = auth_configs.disable("auth_12345")
+
+ mock_client.auth_configs.update_status.assert_called_once_with(
+ "DISABLED", nanoid="auth_12345"
+ )
+ assert result == mock_response
+
+ def test_enable_handles_api_error(self, auth_configs, mock_client):
+ """Test enable handles API errors."""
+ mock_client.auth_configs.update_status.side_effect = Exception("Enable failed")
+
+ with pytest.raises(Exception) as exc_info:
+ auth_configs.enable("auth_12345")
+
+ assert "Enable failed" in str(exc_info.value)
+
+ def test_disable_handles_api_error(self, auth_configs, mock_client):
+ """Test disable handles API errors."""
+ mock_client.auth_configs.update_status.side_effect = Exception("Disable failed")
+
+ with pytest.raises(Exception) as exc_info:
+ auth_configs.disable("auth_12345")
+
+ assert "Disable failed" in str(exc_info.value)
+
+ # Edge cases
+ def test_update_with_missing_optional_fields(self, auth_configs, mock_client):
+ """Test update works with only required fields."""
+ mock_response = {"id": "auth_12345", "status": "success"}
+ mock_client.auth_configs.update.return_value = mock_response
+
+ options = {
+ "type": "custom",
+ "credentials": {"api_key": "key"},
+ }
+
+ result = auth_configs.update("auth_12345", options=options)
+
+ call_args = mock_client.auth_configs.update.call_args
+ # Verify that optional fields use the sentinel value
+ assert call_args.kwargs["is_enabled_for_tool_router"] == mock_client.not_given
+ assert call_args.kwargs["tool_access_config"] == mock_client.not_given
+ assert result == mock_response
+
+ def test_create_with_minimal_options(self, auth_configs, mock_client):
+ """Test creating auth config with minimal options."""
+ mock_auth_config = Mock(spec=auth_config_create_response.AuthConfig)
+ mock_auth_config.id = "auth_12345"
+
+ mock_response = Mock(spec=auth_config_create_response.AuthConfigCreateResponse)
+ mock_response.auth_config = mock_auth_config
+
+ mock_client.auth_configs.create.return_value = mock_response
+
+ # Just the toolkit, using default type
+ result = auth_configs.create("github", {"type": "use_composio_managed_auth"})
+
+ mock_client.auth_configs.create.assert_called_once()
+ assert result == mock_auth_config
+
+ def test_list_with_pagination(self, auth_configs, mock_client):
+ """Test listing auth configs with pagination."""
+ mock_response = Mock(spec=auth_config_list_response.AuthConfigListResponse)
+ mock_response.items = [Mock(), Mock(), Mock()]
+ mock_response.next_cursor = "next_page_cursor"
+ mock_response.total_pages = 5
+ mock_client.auth_configs.list.return_value = mock_response
+
+ result = auth_configs.list(cursor="current_cursor", limit=3)
+
+ mock_client.auth_configs.list.assert_called_once()
+ assert len(result.items) == 3
+ assert result.next_cursor == "next_page_cursor"
+ assert result.total_pages == 5
+
+ def test_get_minimal_auth_config(self, auth_configs, mock_client):
+ """Test retrieving auth config with minimal fields."""
+ minimal_response = Mock(
+ spec=auth_config_retrieve_response.AuthConfigRetrieveResponse
+ )
+ minimal_response.id = "auth_minimal"
+ minimal_response.name = "Minimal Config"
+ minimal_response.no_of_connections = 0
+ minimal_response.status = "DISABLED"
+ minimal_response.toolkit = Mock()
+ minimal_response.toolkit.logo = ""
+ minimal_response.toolkit.slug = "minimal-toolkit"
+ minimal_response.uuid = "uuid-minimal"
+
+ mock_client.auth_configs.retrieve.return_value = minimal_response
+
+ result = auth_configs.get("auth_minimal")
+
+ assert result.id == "auth_minimal"
+ assert result.name == "Minimal Config"
+ assert result.no_of_connections == 0
+ assert result.status == "DISABLED"
+
+
+class TestAuthConfigsOverloads:
+ """Test type overloads for create and update methods."""
+
+ @pytest.fixture
+ def mock_client(self):
+ """Create a mock client for testing."""
+ client = Mock()
+ client.auth_configs = Mock()
+ client.auth_configs.create = Mock()
+ client.auth_configs.update = Mock()
+ client.not_given = object()
+ return client
+
+ @pytest.fixture
+ def auth_configs(self, mock_client):
+ """Create an AuthConfigs instance with mock client."""
+ return AuthConfigs(client=mock_client)
+
+ def test_create_overload_use_composio_managed_auth(self, auth_configs, mock_client):
+ """Test create with use_composio_managed_auth type."""
+ mock_auth_config = Mock(spec=auth_config_create_response.AuthConfig)
+ mock_response = Mock(spec=auth_config_create_response.AuthConfigCreateResponse)
+ mock_response.auth_config = mock_auth_config
+ mock_client.auth_configs.create.return_value = mock_response
+
+ options = {"type": "use_composio_managed_auth"}
+ result = auth_configs.create("github", options)
+
+ assert result == mock_auth_config
+
+ def test_create_overload_use_custom_auth(self, auth_configs, mock_client):
+ """Test create with use_custom_auth type."""
+ mock_auth_config = Mock(spec=auth_config_create_response.AuthConfig)
+ mock_response = Mock(spec=auth_config_create_response.AuthConfigCreateResponse)
+ mock_response.auth_config = mock_auth_config
+ mock_client.auth_configs.create.return_value = mock_response
+
+ options = {
+ "type": "use_custom_auth",
+ "auth_scheme": "API_KEY",
+ "credentials": {"api_key": "test_key"},
+ }
+ result = auth_configs.create("github", options)
+
+ assert result == mock_auth_config
+
+ def test_update_overload_custom_type(self, auth_configs, mock_client):
+ """Test update with custom type."""
+ mock_response = {"id": "auth_12345", "status": "success"}
+ mock_client.auth_configs.update.return_value = mock_response
+
+ options = {
+ "type": "custom",
+ "credentials": {"api_key": "new_key"},
+ }
+ result = auth_configs.update("auth_12345", options=options)
+
+ assert result == mock_response
+
+ def test_update_overload_default_type(self, auth_configs, mock_client):
+ """Test update with default type."""
+ mock_response = {"id": "auth_12345", "status": "success"}
+ mock_client.auth_configs.update.return_value = mock_response
+
+ options = {
+ "type": "default",
+ "scopes": "read:user",
+ }
+ result = auth_configs.update("auth_12345", options=options)
+
+ assert result == mock_response
diff --git a/python/tests/test_auto_upload_download_files.py b/python/tests/test_auto_upload_download_files.py
index e4694256e..e74027e4a 100644
--- a/python/tests/test_auto_upload_download_files.py
+++ b/python/tests/test_auto_upload_download_files.py
@@ -51,6 +51,7 @@ def create_mock_tool(
available_versions=["v1.0.0"],
version="v1.0.0",
scopes=[],
+ status="active",
toolkit=tool_list_response.ItemToolkit(
name=toolkit_slug.title(), slug=toolkit_slug, logo=""
),
diff --git a/python/tests/test_files.py b/python/tests/test_files.py
index 998a135f6..56e7b6e36 100644
--- a/python/tests/test_files.py
+++ b/python/tests/test_files.py
@@ -55,6 +55,7 @@ def mock_tool():
available_versions=["v1.0.0"],
version="v1.0.0",
scopes=[],
+ status="active",
toolkit=tool_list_response.ItemToolkit(
name="Test Toolkit", slug="test_toolkit", logo=""
),
diff --git a/python/tests/test_provider.py b/python/tests/test_provider.py
index 10dfdfc8f..a40aafc95 100644
--- a/python/tests/test_provider.py
+++ b/python/tests/test_provider.py
@@ -38,6 +38,7 @@ def create_mock_tool(
available_versions=[version],
version=version,
scopes=[],
+ status="active",
toolkit=tool_list_response.ItemToolkit(
name=toolkit_slug.title(), slug=toolkit_slug, logo=""
),
diff --git a/python/tests/test_tool_execution.py b/python/tests/test_tool_execution.py
index 3408cc9a1..5a401ca06 100644
--- a/python/tests/test_tool_execution.py
+++ b/python/tests/test_tool_execution.py
@@ -32,6 +32,7 @@ class TestToolExecution:
available_versions=["v1.0.0"],
version="v1.0.0",
scopes=[],
+ status="active",
toolkit=tool_list_response.ItemToolkit(
name=toolkit_slug.title(), slug=toolkit_slug, logo=""
),
diff --git a/ts/packages/core/src/models/AuthConfigs.ts b/ts/packages/core/src/models/AuthConfigs.ts
index d8cea9493..3d3194d8e 100644
--- a/ts/packages/core/src/models/AuthConfigs.ts
+++ b/ts/packages/core/src/models/AuthConfigs.ts
@@ -128,6 +128,7 @@ export class AuthConfigs {
name: parsedOptions.data.name,
authScheme: parsedOptions.data.authScheme,
credentials: parsedOptions.data.credentials,
+ is_enabled_for_tool_router: parsedOptions.data.isEnabledForToolRouter,
proxy_config: parsedOptions.data.proxyConfig
? {
proxy_url: parsedOptions.data.proxyConfig.proxyUrl,
@@ -145,6 +146,7 @@ export class AuthConfigs {
type: parsedOptions.data.type,
credentials: parsedOptions.data.credentials,
name: parsedOptions.data.name,
+ is_enabled_for_tool_router: parsedOptions.data.isEnabledForToolRouter,
tool_access_config: parsedOptions.data.toolAccessConfig
? {
tools_for_connected_account_creation:
@@ -223,6 +225,7 @@ export class AuthConfigs {
? {
type: 'custom',
credentials: parsedData.data.credentials,
+ is_enabled_for_tool_router: parsedData.data.isEnabledForToolRouter,
tool_access_config: {
tools_for_connected_account_creation:
parsedData.data.toolAccessConfig?.toolsForConnectedAccountCreation,
@@ -234,6 +237,7 @@ export class AuthConfigs {
: {
type: 'default',
scopes: parsedData.data.scopes,
+ is_enabled_for_tool_router: parsedData.data.isEnabledForToolRouter,
tool_access_config: {
tools_for_connected_account_creation:
parsedData.data.toolAccessConfig?.toolsForConnectedAccountCreation,
diff --git a/ts/packages/core/src/types/authConfigs.types.ts b/ts/packages/core/src/types/authConfigs.types.ts
index 4a6ba491c..39e5a2058 100644
--- a/ts/packages/core/src/types/authConfigs.types.ts
+++ b/ts/packages/core/src/types/authConfigs.types.ts
@@ -59,13 +59,21 @@ export const CreateCustomAuthConfigParamsSchema = z.object({
})
.optional(),
toolAccessConfig: AuthConfigCreationToolAccessConfigSchema.optional(),
+ isEnabledForToolRouter: z.boolean().optional(),
});
export const CreateComposioManagedAuthConfigParamsSchema = z.object({
type: z.literal('use_composio_managed_auth'),
name: z.string().optional(),
- credentials: z.record(z.string(), z.union([z.string(), z.number(), z.boolean()])).optional(),
+ credentials: z
+ .object({
+ scopes: z.union([z.string(), z.array(z.string())]).optional(),
+ user_scopes: z.union([z.string(), z.array(z.string())]).optional(),
+ })
+ .passthrough()
+ .optional(),
toolAccessConfig: AuthConfigCreationToolAccessConfigSchema.optional(),
+ isEnabledForToolRouter: z.boolean().optional(),
});
/**
@@ -99,6 +107,7 @@ export const AuthConfigRetrieveResponseSchema = z.object({
authScheme: AuthSchemeEnum.optional(),
credentials: z.record(z.string(), z.unknown()).optional(),
expectedInputFields: z.array(z.unknown()).optional(),
+ isEnabledForToolRouter: z.boolean().optional(),
/**
* @deprecated - use tool access config to determine the tools that the user can perform on the auth config.
*/
@@ -127,8 +136,15 @@ export const AuthConfigListResponseSchema = z.object({
export type AuthConfigListResponse = z.infer<typeof AuthConfigListResponseSchema>;
export const AuthCustomConfigUpdateParamsSchema = z.object({
- credentials: z.record(z.string(), z.union([z.string(), z.unknown()])),
type: z.literal('custom'),
+ credentials: z
+ .object({
+ scopes: z.union([z.string(), z.array(z.string())]).optional(),
+ user_scopes: z.union([z.string(), z.array(z.string())]).optional(),
+ })
+ .passthrough()
+ .optional(),
+ isEnabledForToolRouter: z.boolean().optional(),
/**
* @deprecated - use tool access config to determine the tools that the user can perform on the auth config.
*/
@@ -137,8 +153,9 @@ export const AuthCustomConfigUpdateParamsSchema = z.object({
});
export const AuthDefaultConfigUpdateParamsSchema = z.object({
- scopes: z.string().optional(),
type: z.literal('default'),
+ scopes: z.string().optional(),
+ isEnabledForToolRouter: z.boolean().optional(),
/**
* @deprecated - use tool access config to determine the tools that the user can perform on the auth config.
*/
diff --git a/ts/packages/core/src/utils/transformers/authConfigs.ts b/ts/packages/core/src/utils/transformers/authConfigs.ts
index 1cb3e5e8a..2af246276 100644
--- a/ts/packages/core/src/utils/transformers/authConfigs.ts
+++ b/ts/packages/core/src/utils/transformers/authConfigs.ts
@@ -40,6 +40,7 @@ export function transformAuthConfigRetrieveResponse(
logo: authConfig.toolkit.logo,
slug: authConfig.toolkit.slug,
},
+ isEnabledForToolRouter: authConfig.is_enabled_for_tool_router,
uuid: authConfig.uuid,
authScheme: authConfig.auth_scheme,
credentials: authConfig.credentials,
diff --git a/ts/packages/core/test/AuthConfigs/authConfigs.test.ts b/ts/packages/core/test/AuthConfigs/authConfigs.test.ts
index 39203c4f3..b0f5114d3 100644
--- a/ts/packages/core/test/AuthConfigs/authConfigs.test.ts
+++ b/ts/packages/core/test/AuthConfigs/authConfigs.test.ts
@@ -2,7 +2,6 @@ import { describe, it, expect, vi, beforeEach } from 'vitest';
import { AuthConfigs } from '../../src/models/AuthConfigs';
import ComposioClient from '@composio/client';
import { ValidationError } from '../../src/errors/ValidationErrors';
-import { ZodError } from 'zod/v3';
import {
AuthConfigRetrieveResponse as ComposioAuthConfigRetrieveResponse,
AuthConfigDeleteResponse,
@@ -398,6 +397,42 @@ describe('AuthConfigs', () => {
await expect(authConfigs.get('nonexistent_auth')).rejects.toThrow('Auth config not found');
});
+
+ it('should retrieve auth config with isEnabledForToolRouter set to true', async () => {
+ const responseWithToolRouter = {
+ ...mockComposioAuthConfigResponse,
+ is_enabled_for_tool_router: true,
+ };
+ mockClient.authConfigs.retrieve.mockResolvedValueOnce(responseWithToolRouter);
+
+ const result = await authConfigs.get('auth_12345');
+
+ expect(result.isEnabledForToolRouter).toBe(true);
+ });
+
+ it('should retrieve auth config with isEnabledForToolRouter set to false', async () => {
+ const responseWithoutToolRouter = {
+ ...mockComposioAuthConfigResponse,
+ is_enabled_for_tool_router: false,
+ };
+ mockClient.authConfigs.retrieve.mockResolvedValueOnce(responseWithoutToolRouter);
+
+ const result = await authConfigs.get('auth_12345');
+
+ expect(result.isEnabledForToolRouter).toBe(false);
+ });
+
+ it('should retrieve auth config with isEnabledForToolRouter undefined', async () => {
+ const responseWithoutField = {
+ ...mockComposioAuthConfigResponse,
+ is_enabled_for_tool_router: undefined,
+ };
+ mockClient.authConfigs.retrieve.mockResolvedValueOnce(responseWithoutField);
+
+ const result = await authConfigs.get('auth_12345');
+
+ expect(result.isEnabledForToolRouter).toBeUndefined();
+ });
});
describe('update', () => {
diff --git a/uv.lock b/uv.lock
index 53b5aa191..f227f7723 100644
--- a/uv.lock
+++ b/uv.lock
@@ -477,7 +477,7 @@ wheels = [
[[package]]
name = "composio"
-version = "0.10.5"
+version = "0.10.6"
source = { virtual = "python" }
dependencies = [
{ name = "composio-client" },
@@ -506,7 +506,7 @@ dev = [
[package.metadata]
requires-dist = [
- { name = "composio-client", specifier = "==1.25.0" },
+ { name = "composio-client", specifier = "==1.26.0" },
{ name = "openai" },
{ name = "pydantic", specifier = ">=2.6.4" },
{ name = "pysher", specifier = ">=1.0.8" },
@@ -532,7 +532,7 @@ dev = [
[[package]]
name = "composio-anthropic"
-version = "0.10.5"
+version = "0.10.6"
source = { virtual = "python/providers/anthropic" }
dependencies = [
{ name = "anthropic" },
@@ -547,7 +547,7 @@ requires-dist = [
[[package]]
name = "composio-client"
-version = "1.25.0"
+version = "1.26.0"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "anyio" },
@@ -557,14 +557,14 @@ dependencies = [
{ name = "sniffio" },
{ name = "typing-extensions" },
]
-sdist = { url = "https://files.pythonhosted.org/packages/c4/72/270a24236f4580d1eced2eb4b38c4a9bd399714ef2b76c74952729687276/composio_client-1.25.0.tar.gz", hash = "sha256:ae335bc90309b9d5f222c48c85a20a4c701afda5e3015cb3472245c01aa632bb", size = 190472 }
+sdist = { url = "https://files.pythonhosted.org/packages/31/ea/e9abfe0a16b10358ea126fae9019808cde5d76fdf17b70cc1df48c7535b6/composio_client-1.26.0.tar.gz", hash = "sha256:8ab65d900025970760c522c8df4445a6a63aff9f78773682f7193928016fb0f7", size = 192874 }
wheels = [
- { url = "https://files.pythonhosted.org/packages/56/0b/9f92a8b2bce0a23f39c98e860fe14e58365d804c0dea8277ed6b4e5e66f4/composio_client-1.25.0-py3-none-any.whl", hash = "sha256:de6b05667f29692a4425b43d53349c7b31439012ffc3f93059ceacb5cc3fbe56", size = 209162 },
+ { url = "https://files.pythonhosted.org/packages/37/2b/ad19b251f0d2241da0227fce6aee5792a6bbf26c09ff1d43841b946e7557/composio_client-1.26.0-py3-none-any.whl", hash = "sha256:24b6b0ffba0b7a1c818da53a77b450bbddc26313f9c6abc1ef4472cfb348e450", size = 210074 },
]
[[package]]
name = "composio-crewai"
-version = "0.10.5"
+version = "0.10.6"
source = { virtual = "python/providers/crewai" }
dependencies = [
{ name = "composio" },
@@ -579,7 +579,7 @@ requires-dist = [
[[package]]
name = "composio-gemini"
-version = "0.10.5"
+version = "0.10.6"
source = { virtual = "python/providers/gemini" }
dependencies = [
{ name = "composio" },
@@ -594,7 +594,7 @@ requires-dist = [
[[package]]
name = "composio-google"
-version = "0.10.5"
+version = "0.10.6"
source = { virtual = "python/providers/google" }
dependencies = [
{ name = "composio" },
@@ -609,7 +609,7 @@ requires-dist = [
[[package]]
name = "composio-google-adk"
-version = "0.10.5"
+version = "0.10.6"
source = { virtual = "python/providers/google_adk" }
dependencies = [
{ name = "composio" },
@@ -624,7 +624,7 @@ requires-dist = [
[[package]]
name = "composio-langchain"
-version = "0.10.5"
+version = "0.10.6"
source = { virtual = "python/providers/langchain" }
dependencies = [
{ name = "composio" },
@@ -639,7 +639,7 @@ requires-dist = [
[[package]]
name = "composio-openai"
-version = "0.10.5"
+version = "0.10.6"
source = { virtual = "python/providers/openai" }
dependencies = [
{ name = "composio" },
@@ -654,7 +654,7 @@ requires-dist = [
[[package]]
name = "composio-openai-agents"
-version = "0.10.5"
+version = "0.10.6"
source = { virtual = "python/providers/openai_agents" }
dependencies = [
{ name = "composio" },
@@ -892,7 +892,7 @@ dev = [
requires-dist = [
{ name = "click", specifier = ">=8.1.7" },
{ name = "composio", virtual = "python" },
- { name = "composio-client", specifier = "==1.25.0" },
+ { name = "composio-client", specifier = "==1.26.0" },
{ name = "composio-gemini", virtual = "python/providers/gemini" },
{ name = "composio-langchain", virtual = "python/providers/langchain" },
{ name = "composio-openai", virtual = "python/providers/openai" },