Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 22, 14:30 UTC
Update composio client package to fix authConfig update changes (#2391)
Co-authored-by: Anshu Garg <166364920+anshugarg15@users.noreply.github.com>
Musthaq Ahamad committed
Jan 14, 2026 at 17:06 UTC
30550484a1345f5e4df1a85129628b21f0ecb2ae
43 files changed
+903
-55
.changeset/deep-eyes-film.md
new
+5
@@ -0,0 +1,5 @@
1
+---
2
+'@composio/core': patch
3
+---
4
+
5
+Update client dependencies and auth config update params to be optional
fern/pages/src/changelog/01-14-26-auth-config-patch-semantics.md
new
+189
@@ -0,0 +1,189 @@
1
+# True PATCH Semantics for Auth Config Updates
2
+
3
+## Version Information
4
+
5
+### TypeScript/JavaScript
6
+- Package: `@composio/core` and provider packages
7
+- Version: `0.5.1`+
8
+
9
+### Python
10
+- Package: `composio-core` and provider packages
11
+- Version: `0.10.7`+
12
+
13
+---
14
+
15
+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.
16
+
17
+<Warning>
18
+**Breaking Change**: If you relied on omitting fields to clear them, you must now explicitly send `null` or `[]`. See [Migration Guide](#migration-guide) below.
19
+</Warning>
20
+
21
+## What Changed
22
+
23
+| Field | Before (Buggy) | After (Correct) |
24
+| ----------------------------- | ------------------------ | --------------------------------- |
25
+| `credentials` | Required on every update | Optional—merged with existing |
26
+| `tool_access_config` | Reset to `{}` if omitted | Preserved if omitted |
27
+| `scopes` (type: default) | Cleared if omitted | Preserved if omitted |
28
+| `restrict_to_following_tools` | Reset to `[]` if omitted | Preserved if omitted |
29
+
30
+<Note>
31
+**Merge Behavior**: The `credentials` object is merged—send only the fields you want to change, and existing fields are preserved.
32
+</Note>
33
+
34
+## New Capabilities
35
+
36
+### Rotate a Single Credential Field
37
+
38
+Update just `client_secret` without resending `client_id` or other fields:
39
+
40
+<CodeBlocks>
41
+```python title="Python SDK"
42
+from composio import Composio
43
+
44
+composio = Composio()
45
+
46
+# Only send the field you want to update - other credentials are preserved
47
+
48
+composio.auth_configs.update(
49
+"ac_yourAuthConfigId",
50
+options={
51
+"type": "custom",
52
+"credentials": {
53
+"client_secret": "new_rotated_secret",
54
+},
55
+},
56
+)
57
+
58
+````
59
+
60
+```typescript title="TypeScript SDK"
61
+import { Composio } from "@composio/core";
62
+
63
+const composio = new Composio();
64
+
65
+// Only send the field you want to update - other credentials are preserved
66
+await composio.authConfigs.update("ac_yourAuthConfigId", {
67
+ type: "custom",
68
+ credentials: {
69
+ client_secret: "new_rotated_secret",
70
+ },
71
+});
72
+````
73
+
74
+</CodeBlocks>
75
+
76
+### Update Tool Restrictions Without Touching Credentials
77
+
78
+Previously, this would fail because `credentials` was required. Now it works:
79
+
80
+<CodeBlocks>
81
+```python title="Python SDK"
82
+from composio import Composio
83
+
84
+composio = Composio()
85
+
86
+# Update tool restrictions - credentials are automatically preserved
87
+
88
+composio.auth_configs.update(
89
+"ac_yourAuthConfigId",
90
+options={
91
+"type": "custom",
92
+"tool_access_config": {
93
+"tools_available_for_execution": ["GMAIL_SEND_EMAIL", "GMAIL_READ_EMAIL"],
94
+},
95
+},
96
+)
97
+
98
+````
99
+
100
+```typescript title="TypeScript SDK"
101
+import { Composio } from "@composio/core";
102
+
103
+const composio = new Composio();
104
+
105
+// Note: TypeScript SDK currently requires credentials for custom type updates
106
+await composio.authConfigs.update("ac_yourAuthConfigId", {
107
+ type: "custom",
108
+ credentials: {
109
+ // Include existing credentials when using TS SDK
110
+ },
111
+ toolAccessConfig: {
112
+ toolsAvailableForExecution: ["GMAIL_SEND_EMAIL", "GMAIL_READ_EMAIL"],
113
+ },
114
+});
115
+````
116
+
117
+</CodeBlocks>
118
+
119
+## Migration Guide
120
+
121
+### Am I Affected?
122
+
123
+**Yes**, if your code relied on omitting fields to clear them.
124
+
125
+**No**, if you always send complete payloads or only use PATCH to update specific fields.
126
+
127
+### How to Clear Fields Explicitly
128
+
129
+| To Clear | Python SDK | TypeScript SDK |
130
+| -------------------- | ------------------------------------------------------------- | ------------------------------------------------------ |
131
+| `tool_access_config` | `"tool_access_config": {"tools_available_for_execution": []}` | `toolAccessConfig: { toolsAvailableForExecution: [] }` |
132
+| `scopes` (default) | `"scopes": ""` | `scopes: ""` (via HTTP API) |
133
+
134
+<CodeBlocks>
135
+```python title="Python SDK - Clear tool restrictions"
136
+from composio import Composio
137
+
138
+composio = Composio()
139
+
140
+# Explicitly clear tool restrictions with empty array
141
+
142
+composio.auth_configs.update(
143
+"ac_yourAuthConfigId",
144
+options={
145
+"type": "custom",
146
+"tool_access_config": {
147
+"tools_available_for_execution": [],
148
+},
149
+},
150
+)
151
+
152
+````
153
+
154
+```typescript title="TypeScript SDK - Clear tool restrictions"
155
+import { Composio } from "@composio/core";
156
+
157
+const composio = new Composio();
158
+
159
+// Explicitly clear tool restrictions with empty array
160
+await composio.authConfigs.update("ac_yourAuthConfigId", {
161
+ type: "custom",
162
+ credentials: {
163
+ // Include existing credentials when using TS SDK
164
+ },
165
+ toolAccessConfig: {
166
+ toolsAvailableForExecution: [],
167
+ },
168
+});
169
+````
170
+
171
+</CodeBlocks>
172
+
173
+### Raw HTTP API
174
+
175
+For users calling the API directly:
176
+
177
+```bash
178
+# Rotate single credential
179
+curl -X PATCH "https://backend.composio.dev/api/v3/auth_configs/{id}" \
180
+ -H "x-api-key: YOUR_API_KEY" \
181
+ -H "Content-Type: application/json" \
182
+ -d '{"type": "custom", "credentials": {"client_secret": "new_secret"}}'
183
+
184
+# Clear tool restrictions
185
+curl -X PATCH "https://backend.composio.dev/api/v3/auth_configs/{id}" \
186
+ -H "x-api-key: YOUR_API_KEY" \
187
+ -H "Content-Type: application/json" \
188
+ -d '{"type": "custom", "tool_access_config": {"tools_available_for_execution": []}}'
189
+```
fern/pyproject.toml
+1
-1
@@ -10,7 +10,7 @@ dependencies = [
10
"click>=8.1.7",
11
"ruamel-yaml>=0.18.10",
12
"typing-extensions>=4.13.0",
13
- "composio-client==1.25.0",
13
+ "composio-client==1.26.0",
14
"openai>=1.79.0",
15
"composio==1.0.0rc5",
16
# Dependencies for SDK doc generation
pnpm-lock.yaml
+8
-8
@@ -16,8 +16,8 @@ catalogs:
16
specifier: ^4.20250917.0
17
version: 4.20250917.0
18
'@composio/client':
19
- specifier: 0.1.0-alpha.54
20
- version: 0.1.0-alpha.54
19
+ specifier: 0.1.0-alpha.55
20
+ version: 0.1.0-alpha.55
21
'@modelcontextprotocol/sdk':
22
specifier: ^1.24.0
23
version: 1.24.1
@@ -882,7 +882,7 @@ importers:
882
version: 1.0.0-alpha.1
883
'@composio/client':
884
specifier: 'catalog:'
885
- version: 0.1.0-alpha.54
885
+ version: 0.1.0-alpha.55
886
'@composio/core':
887
specifier: workspace:*
888
version: link:../core
@@ -976,7 +976,7 @@ importers:
976
dependencies:
977
'@composio/client':
978
specifier: 'catalog:'
979
- version: 0.1.0-alpha.54
979
+ version: 0.1.0-alpha.55
980
'@composio/json-schema-to-zod':
981
specifier: workspace:*
982
version: link:../json-schema-to-zod
@@ -1712,8 +1712,8 @@ packages:
1712
resolution: {integrity: sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==}
1713
engines: {node: '>=0.1.90'}
1714
1715
- '@composio/client@0.1.0-alpha.54':
1716
- resolution: {integrity: sha512-3whr4XjaMQUTcxmkaePMPeISUEE3NDRmGaf6lHReS9M2t6jiQbuZT3OktBvvw9QHrH+AZPXgaDoH65Hlr4qGWA==}
1715
+ '@composio/client@0.1.0-alpha.55':
1716
+ resolution: {integrity: sha512-nINJ2bgqZi+eyNSPSd1p9hc7CryXqYonlhJqaw6U9gUeLYBq27ASpIM3ddi61j+6U6+ZKeaX1FmO3hcJwH4wCw==}
1717
1718
'@composio/mcp@1.0.3-0':
1719
resolution: {integrity: sha512-IpbfST0SSs/CEv+PIf6+EL0feNuJhQyUrOHJLPge8NhyLLrCyVqvujRIPyRUUjy0NDsked/Mm5VpJmYM6OACbg==}
@@ -7835,7 +7835,7 @@ snapshots:
7835
dependencies:
7836
'@ai-sdk/provider': 2.0.0
7837
'@ai-sdk/provider-utils': 3.0.10(zod@4.3.5)
7838
- '@vercel/oidc': 3.0.5
7838
+ '@vercel/oidc': 3.1.0
7839
zod: 4.3.5
7840
7841
'@ai-sdk/gateway@2.0.0(zod@3.25.76)':
@@ -8439,7 +8439,7 @@ snapshots:
8439
'@colors/colors@1.5.0':
8440
optional: true
8441
8442
- '@composio/client@0.1.0-alpha.54': {}
8442
+ '@composio/client@0.1.0-alpha.55': {}
8443
8444
'@composio/mcp@1.0.3-0': {}
8445
pnpm-workspace.yaml
+1
-1
@@ -18,7 +18,7 @@ catalog:
18
'@arethetypeswrong/cli': ^0.18.2
19
'@cloudflare/vitest-pool-workers': ^0.9.2
20
'@cloudflare/workers-types': ^4.20250917.0
21
- '@composio/client': 0.1.0-alpha.54
21
+ '@composio/client': 0.1.0-alpha.55
22
'@modelcontextprotocol/sdk': ^1.24.0
23
ai: ^6.0.3
24
openai: ^5.20.3
python/composio/core/models/auth_configs.py
+3
@@ -95,6 +95,9 @@ class AuthConfigs(Resource):
95
nanoid=nanoid,
96
type=options["type"], # type: ignore
97
credentials=options.get("credentials", self._client.not_given),
98
+ is_enabled_for_tool_router=options.get(
99
+ "is_enabled_for_tool_router", self._client.not_given
100
+ ),
101
tool_access_config=options.get(
102
"tool_access_config", self._client.not_given
103
),
python/composio/core/models/custom_tools.py
+1
@@ -91,6 +91,7 @@ class CustomTool:
91
version="1.0.0",
92
scopes=[],
93
slug=self.slug,
94
+ status="active",
95
toolkit=tool_list_response.ItemToolkit(
96
logo="",
97
name=self.toolkit or "custom",
python/providers/anthropic/pyproject.toml
+1
-1
@@ -1,6 +1,6 @@
1
[project]
2
name = "composio-anthropic"
3
-version = "0.10.6"
3
+version = "0.10.7"
4
description = "Use Composio to get an array of tools with your Anthropic LLMs."
5
readme = "README.md"
6
requires-python = ">=3.10,<4"
python/providers/anthropic/setup.py
+1
-1
@@ -8,7 +8,7 @@ from setuptools import setup
8
9
setup(
10
name="composio_anthropic",
11
- version="0.10.6",
11
+ version="0.10.7",
12
author="Composio",
13
author_email="tech@composio.dev",
14
description="Use Composio to get an array of tools with your Anthropic LLMs.",
python/providers/autogen/pyproject.toml
+1
-1
@@ -1,6 +1,6 @@
1
[project]
2
name = "composio-autogen"
3
-version = "0.10.6"
3
+version = "0.10.7"
4
description = "Use Composio to get an array of tools with your autogen agent."
5
readme = "README.md"
6
requires-python = ">=3.9,<4"
python/providers/autogen/setup.py
+1
-1
@@ -8,7 +8,7 @@ from setuptools import setup
8
9
setup(
10
name="composio_autogen",
11
- version="0.10.6",
11
+ version="0.10.7",
12
author="Composio",
13
author_email="tech@composio.dev",
14
description="Use Composio to get an array of tools with your Autogen agent.",
python/providers/claude_agent_sdk/pyproject.toml
+1
-1
@@ -1,6 +1,6 @@
1
[project]
2
name = "composio-claude-agent-sdk"
3
-version = "0.10.6"
3
+version = "0.10.7"
4
description = "Use Composio to get an array of tools with Claude Code Agents SDK."
5
readme = "README.md"
6
requires-python = ">=3.10,<4"
python/providers/claude_agent_sdk/setup.py
+1
-1
@@ -8,7 +8,7 @@ from setuptools import find_packages, setup
8
9
setup(
10
name="composio_claude_agent_sdk",
11
- version="0.10.6",
11
+ version="0.10.7",
12
author="Composio",
13
author_email="tech@composio.dev",
14
description="Use Composio to get array of tools for Claude Agent SDK",
python/providers/crewai/pyproject.toml
+1
-1
@@ -1,6 +1,6 @@
1
[project]
2
name = "composio-crewai"
3
-version = "0.10.6"
3
+version = "0.10.7"
4
description = "Use Composio to get an array of tools with your CrewAI agent."
5
readme = "README.md"
6
requires-python = ">=3.9,<4"
python/providers/crewai/setup.py
+1
-1
@@ -6,7 +6,7 @@ from setuptools import setup
6
7
setup(
8
name="composio_crewai",
9
- version="0.10.6",
9
+ version="0.10.7",
10
author="Composio",
11
author_email="tech@composio.dev",
12
description="Use Composio to get an array of tools with your CrewAI agent.",
python/providers/gemini/pyproject.toml
+1
-1
@@ -1,6 +1,6 @@
1
[project]
2
name = "composio-gemini"
3
-version = "0.10.6"
3
+version = "0.10.7"
4
description = "Use Composio to get an array of tools with your Gemini agent."
5
readme = "README.md"
6
requires-python = ">=3.9,<4"
python/providers/gemini/setup.py
+1
-1
@@ -8,7 +8,7 @@ from setuptools import setup
8
9
setup(
10
name="composio_gemini",
11
- version="0.10.6",
11
+ version="0.10.7",
12
author="Composio",
13
author_email="tech@composio.dev",
14
description="Use Composio to get an array of tools with your Gemini agent.",
python/providers/google/pyproject.toml
+1
-1
@@ -1,6 +1,6 @@
1
[project]
2
name = "composio-google"
3
-version = "0.10.6"
3
+version = "0.10.7"
4
description = "Use Composio to get an array of tools with your Google AI Python Gemini model."
5
readme = "README.md"
6
requires-python = ">=3.9,<4"
python/providers/google/setup.py
+1
-1
@@ -8,7 +8,7 @@ from setuptools import setup
8
9
setup(
10
name="composio_google",
11
- version="0.10.6",
11
+ version="0.10.7",
12
author="Composio",
13
author_email="tech@composio.dev",
14
description="Use Composio to get an array of tools with your Google AI Python Gemini model.",
python/providers/google_adk/pyproject.toml
+1
-1
@@ -1,6 +1,6 @@
1
[project]
2
name = "composio-google-adk"
3
-version = "0.10.6"
3
+version = "0.10.7"
4
description = "Use Composio to get an array of tools with your Google AI Python Gemini model."
5
readme = "README.md"
6
requires-python = ">=3.9,<4"
python/providers/google_adk/setup.py
+1
-1
@@ -8,7 +8,7 @@ from setuptools import setup
8
9
setup(
10
name="composio_google_adk",
11
- version="0.10.6",
11
+ version="0.10.7",
12
author="Composio",
13
author_email="tech@composio.dev",
14
description="Use Composio to get an array of tools with your Google AI Python Gemini model.",
python/providers/langchain/pyproject.toml
+1
-1
@@ -1,6 +1,6 @@
1
[project]
2
name = "composio-langchain"
3
-version = "0.10.6"
3
+version = "0.10.7"
4
description = "Use Composio to get an array of tools with your Langchain agent."
5
readme = "README.md"
6
requires-python = ">=3.9,<4"
python/providers/langchain/setup.py
+1
-1
@@ -8,7 +8,7 @@ from setuptools import setup
8
9
setup(
10
name="composio_langchain",
11
- version="0.10.6",
11
+ version="0.10.7",
12
author="composio",
13
author_email="tech@composio.dev",
14
description="Use Composio to get an array of tools with your Langchain agent.",
python/providers/langgraph/pyproject.toml
+1
-1
@@ -1,6 +1,6 @@
1
[project]
2
name = "composio-langgraph"
3
-version = "0.10.6"
3
+version = "0.10.7"
4
description = "Use Composio to get array of tools with LangGraph Agent Workflows."
5
readme = "README.md"
6
requires-python = ">=3.9,<4"
python/providers/langgraph/setup.py
+1
-1
@@ -8,7 +8,7 @@ from setuptools import setup
8
9
setup(
10
name="composio_langgraph",
11
- version="0.10.6",
11
+ version="0.10.7",
12
author="composio",
13
author_email="tech@composio.dev",
14
description="Use Composio to get array of tools with LangGraph Agent Workflows",
python/providers/llamaindex/pyproject.toml
+1
-1
@@ -1,6 +1,6 @@
1
[project]
2
name = "composio-llamaindex"
3
-version = "0.10.6"
3
+version = "0.10.7"
4
description = "Use Composio to get array of tools with LlamaIndex Agent Workflows."
5
readme = "README.md"
6
requires-python = ">=3.9,<4"
python/providers/llamaindex/setup.py
+1
-1
@@ -8,7 +8,7 @@ from setuptools import setup
8
9
setup(
10
name="composio_llamaindex",
11
- version="0.10.6",
11
+ version="0.10.7",
12
author="composio",
13
author_email="tech@composio.dev",
14
description="Use Composio to get array of tools with LlamaIndex Agent Workflows",
python/providers/openai/pyproject.toml
+1
-1
@@ -1,6 +1,6 @@
1
[project]
2
name = "composio-openai"
3
-version = "0.10.6"
3
+version = "0.10.7"
4
description = "Use Composio to get an array of tools with your OpenAI Function Call."
5
readme = "README.md"
6
requires-python = ">=3.9,<4"
python/providers/openai/setup.py
+1
-1
@@ -8,7 +8,7 @@ from setuptools import setup
8
9
setup(
10
name="composio_openai",
11
- version="0.10.6",
11
+ version="0.10.7",
12
author="Composio",
13
author_email="tech@composio.dev",
14
description="Use Composio to get an array of tools with your OpenAI Function Call.",
python/providers/openai_agents/pyproject.toml
+1
-1
@@ -1,6 +1,6 @@
1
[project]
2
name = "composio-openai-agents"
3
-version = "0.10.6"
3
+version = "0.10.7"
4
description = "Use Composio to get array of strongly typed tools for OpenAI Agents"
5
readme = "README.md"
6
requires-python = ">=3.9,<4"
python/providers/openai_agents/setup.py
+1
-1
@@ -8,7 +8,7 @@ from setuptools import find_packages, setup
8
9
setup(
10
name="composio_openai_agents",
11
- version="0.10.6",
11
+ version="0.10.7",
12
author="Composio",
13
author_email="tech@composio.dev",
14
description="Use Composio to get array of strongly typed tools for OpenAI Agents",
python/pyproject.toml
+2
-2
@@ -1,13 +1,13 @@
1
[project]
2
name = "composio"
3
-version = "0.10.6"
3
+version = "0.10.7"
4
description = "SDK for integrating Composio with your applications."
5
readme = "README.md"
6
requires-python = ">=3.10,<4"
7
dependencies = [
8
"pysher>=1.0.8",
9
"pydantic>=2.6.4",
10
- "composio-client==1.25.0",
10
+ "composio-client==1.26.0",
11
"typing-extensions>=4.0.0",
12
"openai",
13
]
python/setup.py
+1
-1
@@ -25,7 +25,7 @@ setup(
25
install_requires=[
26
"pysher==1.0.8",
27
"pydantic>=2.6.4",
28
- "composio-client==1.25.0",
28
+ "composio-client==1.26.0",
29
"typing-extensions>=4.0.0",
30
],
31
include_package_data=True,
python/tests/test_auth_configs.py
new
+589
@@ -0,0 +1,589 @@
1
+"""Tests for auth configs management."""
2
+
3
+import pytest
4
+from unittest.mock import Mock
5
+
6
+from composio.core.models.auth_configs import AuthConfigs
7
+from composio.client.types import (
8
+ auth_config_list_response,
9
+ auth_config_create_response,
10
+ auth_config_retrieve_response,
11
+)
12
+
13
+
14
+class TestAuthConfigs:
15
+ """Test suite for AuthConfigs class."""
16
+
17
+ @pytest.fixture
18
+ def mock_client(self):
19
+ """Create a mock client for testing."""
20
+ client = Mock()
21
+ client.auth_configs = Mock()
22
+ client.auth_configs.list = Mock()
23
+ client.auth_configs.create = Mock()
24
+ client.auth_configs.retrieve = Mock()
25
+ client.auth_configs.update = Mock()
26
+ client.auth_configs.delete = Mock()
27
+ client.auth_configs.update_status = Mock()
28
+ client.not_given = object() # Sentinel value for optional params
29
+ return client
30
+
31
+ @pytest.fixture
32
+ def auth_configs(self, mock_client):
33
+ """Create an AuthConfigs instance with mock client."""
34
+ return AuthConfigs(client=mock_client)
35
+
36
+ @pytest.fixture
37
+ def mock_auth_config_response(self):
38
+ """Mock auth config retrieve response."""
39
+ response = Mock(spec=auth_config_retrieve_response.AuthConfigRetrieveResponse)
40
+ response.id = "auth_12345"
41
+ response.name = "Test Auth Config"
42
+ response.no_of_connections = 5
43
+ response.status = "ENABLED"
44
+ response.toolkit = Mock()
45
+ response.toolkit.logo = "https://example.com/logo.png"
46
+ response.toolkit.slug = "github"
47
+ response.uuid = "uuid-12345"
48
+ response.auth_scheme = "OAUTH2"
49
+ response.credentials = {
50
+ "client_id": "test_client_id",
51
+ "client_secret": "test_client_secret",
52
+ }
53
+ response.expected_input_fields = [
54
+ {"name": "client_id", "type": "string"},
55
+ {"name": "client_secret", "type": "string"},
56
+ ]
57
+ response.is_composio_managed = True
58
+ response.created_by = "user_123"
59
+ response.created_at = "2023-01-01T00:00:00Z"
60
+ response.last_updated_at = "2023-01-01T00:00:00Z"
61
+ return response
62
+
63
+ def test_constructor_creates_instance(self, auth_configs, mock_client):
64
+ """Test that AuthConfigs instance is created successfully."""
65
+ assert isinstance(auth_configs, AuthConfigs)
66
+ assert auth_configs._client is mock_client
67
+
68
+ # List tests
69
+ def test_list_without_params(self, auth_configs, mock_client):
70
+ """Test listing auth configs without query parameters."""
71
+ mock_response = Mock(spec=auth_config_list_response.AuthConfigListResponse)
72
+ mock_response.items = []
73
+ mock_response.next_cursor = None
74
+ mock_response.total_pages = 0
75
+ mock_client.auth_configs.list.return_value = mock_response
76
+
77
+ result = auth_configs.list()
78
+
79
+ mock_client.auth_configs.list.assert_called_once_with()
80
+ assert result == mock_response
81
+
82
+ def test_list_with_params(self, auth_configs, mock_client):
83
+ """Test listing auth configs with query parameters."""
84
+ mock_response = Mock(spec=auth_config_list_response.AuthConfigListResponse)
85
+ mock_response.items = []
86
+ mock_client.auth_configs.list.return_value = mock_response
87
+
88
+ result = auth_configs.list(
89
+ cursor="cursor_123",
90
+ is_composio_managed=True,
91
+ limit=10,
92
+ toolkit_slug="github",
93
+ )
94
+
95
+ mock_client.auth_configs.list.assert_called_once_with(
96
+ cursor="cursor_123",
97
+ is_composio_managed=True,
98
+ limit=10,
99
+ toolkit_slug="github",
100
+ )
101
+ assert result == mock_response
102
+
103
+ def test_list_with_empty_result(self, auth_configs, mock_client):
104
+ """Test listing auth configs returns empty list."""
105
+ mock_response = Mock(spec=auth_config_list_response.AuthConfigListResponse)
106
+ mock_response.items = []
107
+ mock_response.next_cursor = None
108
+ mock_response.total_pages = 0
109
+ mock_client.auth_configs.list.return_value = mock_response
110
+
111
+ result = auth_configs.list()
112
+
113
+ assert len(result.items) == 0
114
+ assert result.next_cursor is None
115
+ assert result.total_pages == 0
116
+
117
+ # Create tests
118
+ def test_create_with_default_composio_managed_auth(self, auth_configs, mock_client):
119
+ """Test creating auth config with default Composio managed type."""
120
+ mock_auth_config = Mock(spec=auth_config_create_response.AuthConfig)
121
+ mock_auth_config.id = "auth_12345"
122
+ mock_auth_config.auth_scheme = "OAUTH2"
123
+ mock_auth_config.is_composio_managed = True
124
+
125
+ mock_response = Mock(spec=auth_config_create_response.AuthConfigCreateResponse)
126
+ mock_response.auth_config = mock_auth_config
127
+
128
+ mock_client.auth_configs.create.return_value = mock_response
129
+
130
+ options = {
131
+ "type": "use_composio_managed_auth",
132
+ "name": "My GitHub Config",
133
+ }
134
+
135
+ result = auth_configs.create("github", options)
136
+
137
+ mock_client.auth_configs.create.assert_called_once()
138
+ call_args = mock_client.auth_configs.create.call_args
139
+ assert call_args.kwargs["toolkit"] == {"slug": "github"}
140
+ assert call_args.kwargs["auth_config"] == options
141
+ assert result == mock_auth_config
142
+
143
+ def test_create_with_custom_auth_and_credentials(self, auth_configs, mock_client):
144
+ """Test creating custom auth config with credentials."""
145
+ mock_auth_config = Mock(spec=auth_config_create_response.AuthConfig)
146
+ mock_auth_config.id = "auth_12345"
147
+ mock_auth_config.auth_scheme = "OAUTH2"
148
+ mock_auth_config.is_composio_managed = False
149
+
150
+ mock_response = Mock(spec=auth_config_create_response.AuthConfigCreateResponse)
151
+ mock_response.auth_config = mock_auth_config
152
+
153
+ mock_client.auth_configs.create.return_value = mock_response
154
+
155
+ options = {
156
+ "type": "use_custom_auth",
157
+ "name": "Custom GitHub Auth",
158
+ "auth_scheme": "OAUTH2",
159
+ "credentials": {
160
+ "client_id": "test_client_id",
161
+ "client_secret": "test_client_secret",
162
+ },
163
+ }
164
+
165
+ result = auth_configs.create("github", options)
166
+
167
+ mock_client.auth_configs.create.assert_called_once()
168
+ call_args = mock_client.auth_configs.create.call_args
169
+ assert call_args.kwargs["toolkit"] == {"slug": "github"}
170
+ assert call_args.kwargs["auth_config"] == options
171
+ assert result.is_composio_managed is False
172
+ assert result.auth_scheme == "OAUTH2"
173
+
174
+ def test_create_with_tool_access_config(self, auth_configs, mock_client):
175
+ """Test creating auth config with tool access configuration."""
176
+ mock_auth_config = Mock(spec=auth_config_create_response.AuthConfig)
177
+ mock_auth_config.id = "auth_12345"
178
+
179
+ mock_response = Mock(spec=auth_config_create_response.AuthConfigCreateResponse)
180
+ mock_response.auth_config = mock_auth_config
181
+
182
+ mock_client.auth_configs.create.return_value = mock_response
183
+
184
+ options = {
185
+ "type": "use_composio_managed_auth",
186
+ "name": "Config with Tool Access",
187
+ "tool_access_config": {
188
+ "tools_for_connected_account_creation": ["GITHUB_CREATE_ISSUE"]
189
+ },
190
+ }
191
+
192
+ result = auth_configs.create("github", options)
193
+
194
+ mock_client.auth_configs.create.assert_called_once()
195
+ assert result == mock_auth_config
196
+
197
+ # Get tests
198
+ def test_get_retrieves_auth_config_by_id(
199
+ self, auth_configs, mock_client, mock_auth_config_response
200
+ ):
201
+ """Test retrieving auth config by ID."""
202
+ mock_client.auth_configs.retrieve.return_value = mock_auth_config_response
203
+
204
+ result = auth_configs.get("auth_12345")
205
+
206
+ mock_client.auth_configs.retrieve.assert_called_once_with("auth_12345")
207
+ assert result == mock_auth_config_response
208
+ assert result.id == "auth_12345"
209
+ assert result.name == "Test Auth Config"
210
+
211
+ def test_get_handles_not_found_error(self, auth_configs, mock_client):
212
+ """Test get handles API error when auth config not found."""
213
+ mock_client.auth_configs.retrieve.side_effect = Exception(
214
+ "Auth config not found"
215
+ )
216
+
217
+ with pytest.raises(Exception) as exc_info:
218
+ auth_configs.get("nonexistent_auth")
219
+
220
+ assert "Auth config not found" in str(exc_info.value)
221
+
222
+ def test_get_with_is_enabled_for_tool_router_true(
223
+ self, auth_configs, mock_client, mock_auth_config_response
224
+ ):
225
+ """Test retrieving auth config with isEnabledForToolRouter set to true."""
226
+ mock_auth_config_response.is_enabled_for_tool_router = True
227
+ mock_client.auth_configs.retrieve.return_value = mock_auth_config_response
228
+
229
+ result = auth_configs.get("auth_12345")
230
+
231
+ assert hasattr(result, "is_enabled_for_tool_router")
232
+ assert result.is_enabled_for_tool_router is True
233
+
234
+ def test_get_with_is_enabled_for_tool_router_false(
235
+ self, auth_configs, mock_client, mock_auth_config_response
236
+ ):
237
+ """Test retrieving auth config with isEnabledForToolRouter set to false."""
238
+ mock_auth_config_response.is_enabled_for_tool_router = False
239
+ mock_client.auth_configs.retrieve.return_value = mock_auth_config_response
240
+
241
+ result = auth_configs.get("auth_12345")
242
+
243
+ assert hasattr(result, "is_enabled_for_tool_router")
244
+ assert result.is_enabled_for_tool_router is False
245
+
246
+ def test_get_with_is_enabled_for_tool_router_undefined(
247
+ self, auth_configs, mock_client, mock_auth_config_response
248
+ ):
249
+ """Test retrieving auth config with isEnabledForToolRouter undefined."""
250
+ # Don't set the attribute at all to simulate undefined
251
+ if hasattr(mock_auth_config_response, "is_enabled_for_tool_router"):
252
+ delattr(mock_auth_config_response, "is_enabled_for_tool_router")
253
+ mock_client.auth_configs.retrieve.return_value = mock_auth_config_response
254
+
255
+ result = auth_configs.get("auth_12345")
256
+
257
+ # Should not have the attribute or it should be None
258
+ assert (
259
+ not hasattr(result, "is_enabled_for_tool_router")
260
+ or result.is_enabled_for_tool_router is None
261
+ )
262
+
263
+ # Update tests
264
+ def test_update_custom_auth_config_with_credentials(
265
+ self, auth_configs, mock_client
266
+ ):
267
+ """Test updating custom auth config with credentials."""
268
+ mock_response = {"id": "auth_12345", "status": "success"}
269
+ mock_client.auth_configs.update.return_value = mock_response
270
+
271
+ options = {
272
+ "type": "custom",
273
+ "credentials": {
274
+ "client_id": "new_client_id",
275
+ "client_secret": "new_client_secret",
276
+ },
277
+ }
278
+
279
+ result = auth_configs.update("auth_12345", options=options)
280
+
281
+ mock_client.auth_configs.update.assert_called_once()
282
+ call_args = mock_client.auth_configs.update.call_args
283
+ assert call_args.kwargs["nanoid"] == "auth_12345"
284
+ assert call_args.kwargs["type"] == "custom"
285
+ assert call_args.kwargs["credentials"] == options["credentials"]
286
+ assert result == mock_response
287
+
288
+ def test_update_default_auth_config_with_scopes(self, auth_configs, mock_client):
289
+ """Test updating default auth config with scopes."""
290
+ mock_response = {"id": "auth_12345", "status": "success"}
291
+ mock_client.auth_configs.update.return_value = mock_response
292
+
293
+ options = {
294
+ "type": "default",
295
+ "scopes": "read:user,repo",
296
+ }
297
+
298
+ result = auth_configs.update("auth_12345", options=options)
299
+
300
+ mock_client.auth_configs.update.assert_called_once()
301
+ # Check that scopes are not directly passed but other fields are
302
+ call_args = mock_client.auth_configs.update.call_args
303
+ assert call_args.kwargs["nanoid"] == "auth_12345"
304
+ assert call_args.kwargs["type"] == "default"
305
+ assert result == mock_response
306
+
307
+ def test_update_with_is_enabled_for_tool_router(self, auth_configs, mock_client):
308
+ """Test updating auth config with isEnabledForToolRouter."""
309
+ mock_response = {"id": "auth_12345", "status": "success"}
310
+ mock_client.auth_configs.update.return_value = mock_response
311
+
312
+ options = {
313
+ "type": "custom",
314
+ "credentials": {"api_key": "new_key"},
315
+ "is_enabled_for_tool_router": True,
316
+ }
317
+
318
+ result = auth_configs.update("auth_12345", options=options)
319
+
320
+ call_args = mock_client.auth_configs.update.call_args
321
+ assert call_args.kwargs["is_enabled_for_tool_router"] is True
322
+ assert result == mock_response
323
+
324
+ def test_update_with_tool_access_config(self, auth_configs, mock_client):
325
+ """Test updating auth config with tool access configuration."""
326
+ mock_response = {"id": "auth_12345", "status": "success"}
327
+ mock_client.auth_configs.update.return_value = mock_response
328
+
329
+ options = {
330
+ "type": "custom",
331
+ "credentials": {"api_key": "new_key"},
332
+ "tool_access_config": {
333
+ "tools_for_connected_account_creation": ["GITHUB_CREATE_ISSUE"]
334
+ },
335
+ }
336
+
337
+ result = auth_configs.update("auth_12345", options=options)
338
+
339
+ call_args = mock_client.auth_configs.update.call_args
340
+ assert call_args.kwargs["tool_access_config"] == options["tool_access_config"]
341
+ assert result == mock_response
342
+
343
+ def test_update_with_large_credential_object(self, auth_configs, mock_client):
344
+ """Test updating auth config with large credential object."""
345
+ mock_response = {"id": "auth_12345", "status": "success"}
346
+ mock_client.auth_configs.update.return_value = mock_response
347
+
348
+ large_credentials = {
349
+ "field1": "value1",
350
+ "field2": "value2",
351
+ "field3": {"nested": "object"},
352
+ "field4": ["array", "values"],
353
+ "field5": 12345,
354
+ "field6": True,
355
+ }
356
+
357
+ options = {
358
+ "type": "custom",
359
+ "credentials": large_credentials,
360
+ }
361
+
362
+ result = auth_configs.update("auth_12345", options=options)
363
+
364
+ call_args = mock_client.auth_configs.update.call_args
365
+ assert call_args.kwargs["credentials"] == large_credentials
366
+ assert result == mock_response
367
+
368
+ def test_update_handles_api_error(self, auth_configs, mock_client):
369
+ """Test update handles API errors."""
370
+ mock_client.auth_configs.update.side_effect = Exception("Update failed")
371
+
372
+ options = {
373
+ "type": "custom",
374
+ "credentials": {"api_key": "key"},
375
+ }
376
+
377
+ with pytest.raises(Exception) as exc_info:
378
+ auth_configs.update("auth_12345", options=options)
379
+
380
+ assert "Update failed" in str(exc_info.value)
381
+
382
+ # Delete tests
383
+ def test_delete_auth_config_by_id(self, auth_configs, mock_client):
384
+ """Test deleting auth config by ID."""
385
+ mock_response = {"id": "auth_12345", "status": "deleted"}
386
+ mock_client.auth_configs.delete.return_value = mock_response
387
+
388
+ result = auth_configs.delete("auth_12345")
389
+
390
+ mock_client.auth_configs.delete.assert_called_once_with("auth_12345")
391
+ assert result == mock_response
392
+
393
+ def test_delete_handles_api_error(self, auth_configs, mock_client):
394
+ """Test delete handles API errors."""
395
+ mock_client.auth_configs.delete.side_effect = Exception("Delete failed")
396
+
397
+ with pytest.raises(Exception) as exc_info:
398
+ auth_configs.delete("auth_12345")
399
+
400
+ assert "Delete failed" in str(exc_info.value)
401
+
402
+ # Enable/Disable tests
403
+ def test_enable_auth_config(self, auth_configs, mock_client):
404
+ """Test enabling auth config."""
405
+ mock_response = {"id": "auth_12345", "status": "ENABLED"}
406
+ mock_client.auth_configs.update_status.return_value = mock_response
407
+
408
+ result = auth_configs.enable("auth_12345")
409
+
410
+ mock_client.auth_configs.update_status.assert_called_once_with(
411
+ "ENABLED", nanoid="auth_12345"
412
+ )
413
+ assert result == mock_response
414
+
415
+ def test_disable_auth_config(self, auth_configs, mock_client):
416
+ """Test disabling auth config."""
417
+ mock_response = {"id": "auth_12345", "status": "DISABLED"}
418
+ mock_client.auth_configs.update_status.return_value = mock_response
419
+
420
+ result = auth_configs.disable("auth_12345")
421
+
422
+ mock_client.auth_configs.update_status.assert_called_once_with(
423
+ "DISABLED", nanoid="auth_12345"
424
+ )
425
+ assert result == mock_response
426
+
427
+ def test_enable_handles_api_error(self, auth_configs, mock_client):
428
+ """Test enable handles API errors."""
429
+ mock_client.auth_configs.update_status.side_effect = Exception("Enable failed")
430
+
431
+ with pytest.raises(Exception) as exc_info:
432
+ auth_configs.enable("auth_12345")
433
+
434
+ assert "Enable failed" in str(exc_info.value)
435
+
436
+ def test_disable_handles_api_error(self, auth_configs, mock_client):
437
+ """Test disable handles API errors."""
438
+ mock_client.auth_configs.update_status.side_effect = Exception("Disable failed")
439
+
440
+ with pytest.raises(Exception) as exc_info:
441
+ auth_configs.disable("auth_12345")
442
+
443
+ assert "Disable failed" in str(exc_info.value)
444
+
445
+ # Edge cases
446
+ def test_update_with_missing_optional_fields(self, auth_configs, mock_client):
447
+ """Test update works with only required fields."""
448
+ mock_response = {"id": "auth_12345", "status": "success"}
449
+ mock_client.auth_configs.update.return_value = mock_response
450
+
451
+ options = {
452
+ "type": "custom",
453
+ "credentials": {"api_key": "key"},
454
+ }
455
+
456
+ result = auth_configs.update("auth_12345", options=options)
457
+
458
+ call_args = mock_client.auth_configs.update.call_args
459
+ # Verify that optional fields use the sentinel value
460
+ assert call_args.kwargs["is_enabled_for_tool_router"] == mock_client.not_given
461
+ assert call_args.kwargs["tool_access_config"] == mock_client.not_given
462
+ assert result == mock_response
463
+
464
+ def test_create_with_minimal_options(self, auth_configs, mock_client):
465
+ """Test creating auth config with minimal options."""
466
+ mock_auth_config = Mock(spec=auth_config_create_response.AuthConfig)
467
+ mock_auth_config.id = "auth_12345"
468
+
469
+ mock_response = Mock(spec=auth_config_create_response.AuthConfigCreateResponse)
470
+ mock_response.auth_config = mock_auth_config
471
+
472
+ mock_client.auth_configs.create.return_value = mock_response
473
+
474
+ # Just the toolkit, using default type
475
+ result = auth_configs.create("github", {"type": "use_composio_managed_auth"})
476
+
477
+ mock_client.auth_configs.create.assert_called_once()
478
+ assert result == mock_auth_config
479
+
480
+ def test_list_with_pagination(self, auth_configs, mock_client):
481
+ """Test listing auth configs with pagination."""
482
+ mock_response = Mock(spec=auth_config_list_response.AuthConfigListResponse)
483
+ mock_response.items = [Mock(), Mock(), Mock()]
484
+ mock_response.next_cursor = "next_page_cursor"
485
+ mock_response.total_pages = 5
486
+ mock_client.auth_configs.list.return_value = mock_response
487
+
488
+ result = auth_configs.list(cursor="current_cursor", limit=3)
489
+
490
+ mock_client.auth_configs.list.assert_called_once()
491
+ assert len(result.items) == 3
492
+ assert result.next_cursor == "next_page_cursor"
493
+ assert result.total_pages == 5
494
+
495
+ def test_get_minimal_auth_config(self, auth_configs, mock_client):
496
+ """Test retrieving auth config with minimal fields."""
497
+ minimal_response = Mock(
498
+ spec=auth_config_retrieve_response.AuthConfigRetrieveResponse
499
+ )
500
+ minimal_response.id = "auth_minimal"
501
+ minimal_response.name = "Minimal Config"
502
+ minimal_response.no_of_connections = 0
503
+ minimal_response.status = "DISABLED"
504
+ minimal_response.toolkit = Mock()
505
+ minimal_response.toolkit.logo = ""
506
+ minimal_response.toolkit.slug = "minimal-toolkit"
507
+ minimal_response.uuid = "uuid-minimal"
508
+
509
+ mock_client.auth_configs.retrieve.return_value = minimal_response
510
+
511
+ result = auth_configs.get("auth_minimal")
512
+
513
+ assert result.id == "auth_minimal"
514
+ assert result.name == "Minimal Config"
515
+ assert result.no_of_connections == 0
516
+ assert result.status == "DISABLED"
517
+
518
+
519
+class TestAuthConfigsOverloads:
520
+ """Test type overloads for create and update methods."""
521
+
522
+ @pytest.fixture
523
+ def mock_client(self):
524
+ """Create a mock client for testing."""
525
+ client = Mock()
526
+ client.auth_configs = Mock()
527
+ client.auth_configs.create = Mock()
528
+ client.auth_configs.update = Mock()
529
+ client.not_given = object()
530
+ return client
531
+
532
+ @pytest.fixture
533
+ def auth_configs(self, mock_client):
534
+ """Create an AuthConfigs instance with mock client."""
535
+ return AuthConfigs(client=mock_client)
536
+
537
+ def test_create_overload_use_composio_managed_auth(self, auth_configs, mock_client):
538
+ """Test create with use_composio_managed_auth type."""
539
+ mock_auth_config = Mock(spec=auth_config_create_response.AuthConfig)
540
+ mock_response = Mock(spec=auth_config_create_response.AuthConfigCreateResponse)
541
+ mock_response.auth_config = mock_auth_config
542
+ mock_client.auth_configs.create.return_value = mock_response
543
+
544
+ options = {"type": "use_composio_managed_auth"}
545
+ result = auth_configs.create("github", options)
546
+
547
+ assert result == mock_auth_config
548
+
549
+ def test_create_overload_use_custom_auth(self, auth_configs, mock_client):
550
+ """Test create with use_custom_auth type."""
551
+ mock_auth_config = Mock(spec=auth_config_create_response.AuthConfig)
552
+ mock_response = Mock(spec=auth_config_create_response.AuthConfigCreateResponse)
553
+ mock_response.auth_config = mock_auth_config
554
+ mock_client.auth_configs.create.return_value = mock_response
555
+
556
+ options = {
557
+ "type": "use_custom_auth",
558
+ "auth_scheme": "API_KEY",
559
+ "credentials": {"api_key": "test_key"},
560
+ }
561
+ result = auth_configs.create("github", options)
562
+
563
+ assert result == mock_auth_config
564
+
565
+ def test_update_overload_custom_type(self, auth_configs, mock_client):
566
+ """Test update with custom type."""
567
+ mock_response = {"id": "auth_12345", "status": "success"}
568
+ mock_client.auth_configs.update.return_value = mock_response
569
+
570
+ options = {
571
+ "type": "custom",
572
+ "credentials": {"api_key": "new_key"},
573
+ }
574
+ result = auth_configs.update("auth_12345", options=options)
575
+
576
+ assert result == mock_response
577
+
578
+ def test_update_overload_default_type(self, auth_configs, mock_client):
579
+ """Test update with default type."""
580
+ mock_response = {"id": "auth_12345", "status": "success"}
581
+ mock_client.auth_configs.update.return_value = mock_response
582
+
583
+ options = {
584
+ "type": "default",
585
+ "scopes": "read:user",
586
+ }
587
+ result = auth_configs.update("auth_12345", options=options)
588
+
589
+ assert result == mock_response
python/tests/test_auto_upload_download_files.py
+1
@@ -51,6 +51,7 @@ def create_mock_tool(
51
available_versions=["v1.0.0"],
52
version="v1.0.0",
53
scopes=[],
54
+ status="active",
55
toolkit=tool_list_response.ItemToolkit(
56
name=toolkit_slug.title(), slug=toolkit_slug, logo=""
57
),
python/tests/test_files.py
+1
@@ -55,6 +55,7 @@ def mock_tool():
55
available_versions=["v1.0.0"],
56
version="v1.0.0",
57
scopes=[],
58
+ status="active",
59
toolkit=tool_list_response.ItemToolkit(
60
name="Test Toolkit", slug="test_toolkit", logo=""
61
),
python/tests/test_provider.py
+1
@@ -38,6 +38,7 @@ def create_mock_tool(
38
available_versions=[version],
39
version=version,
40
scopes=[],
41
+ status="active",
42
toolkit=tool_list_response.ItemToolkit(
43
name=toolkit_slug.title(), slug=toolkit_slug, logo=""
44
),
python/tests/test_tool_execution.py
+1
@@ -32,6 +32,7 @@ class TestToolExecution:
32
available_versions=["v1.0.0"],
33
version="v1.0.0",
34
scopes=[],
35
+ status="active",
36
toolkit=tool_list_response.ItemToolkit(
37
name=toolkit_slug.title(), slug=toolkit_slug, logo=""
38
),
ts/packages/core/src/models/AuthConfigs.ts
+4
@@ -128,6 +128,7 @@ export class AuthConfigs {
128
name: parsedOptions.data.name,
129
authScheme: parsedOptions.data.authScheme,
130
credentials: parsedOptions.data.credentials,
131
+ is_enabled_for_tool_router: parsedOptions.data.isEnabledForToolRouter,
132
proxy_config: parsedOptions.data.proxyConfig
133
? {
134
proxy_url: parsedOptions.data.proxyConfig.proxyUrl,
@@ -145,6 +146,7 @@ export class AuthConfigs {
146
type: parsedOptions.data.type,
147
credentials: parsedOptions.data.credentials,
148
name: parsedOptions.data.name,
149
+ is_enabled_for_tool_router: parsedOptions.data.isEnabledForToolRouter,
150
tool_access_config: parsedOptions.data.toolAccessConfig
151
? {
152
tools_for_connected_account_creation:
@@ -223,6 +225,7 @@ export class AuthConfigs {
225
? {
226
type: 'custom',
227
credentials: parsedData.data.credentials,
228
+ is_enabled_for_tool_router: parsedData.data.isEnabledForToolRouter,
229
tool_access_config: {
230
tools_for_connected_account_creation:
231
parsedData.data.toolAccessConfig?.toolsForConnectedAccountCreation,
@@ -234,6 +237,7 @@ export class AuthConfigs {
237
: {
238
type: 'default',
239
scopes: parsedData.data.scopes,
240
+ is_enabled_for_tool_router: parsedData.data.isEnabledForToolRouter,
241
tool_access_config: {
242
tools_for_connected_account_creation:
243
parsedData.data.toolAccessConfig?.toolsForConnectedAccountCreation,
ts/packages/core/src/types/authConfigs.types.ts
+20
-3
@@ -59,13 +59,21 @@ export const CreateCustomAuthConfigParamsSchema = z.object({
59
})
60
.optional(),
61
toolAccessConfig: AuthConfigCreationToolAccessConfigSchema.optional(),
62
+ isEnabledForToolRouter: z.boolean().optional(),
63
});
64
65
export const CreateComposioManagedAuthConfigParamsSchema = z.object({
66
type: z.literal('use_composio_managed_auth'),
67
name: z.string().optional(),
67
- credentials: z.record(z.string(), z.union([z.string(), z.number(), z.boolean()])).optional(),
68
+ credentials: z
69
+ .object({
70
+ scopes: z.union([z.string(), z.array(z.string())]).optional(),
71
+ user_scopes: z.union([z.string(), z.array(z.string())]).optional(),
72
+ })
73
+ .passthrough()
74
+ .optional(),
75
toolAccessConfig: AuthConfigCreationToolAccessConfigSchema.optional(),
76
+ isEnabledForToolRouter: z.boolean().optional(),
77
});
78
79
/**
@@ -99,6 +107,7 @@ export const AuthConfigRetrieveResponseSchema = z.object({
107
authScheme: AuthSchemeEnum.optional(),
108
credentials: z.record(z.string(), z.unknown()).optional(),
109
expectedInputFields: z.array(z.unknown()).optional(),
110
+ isEnabledForToolRouter: z.boolean().optional(),
111
/**
112
* @deprecated - use tool access config to determine the tools that the user can perform on the auth config.
113
*/
@@ -127,8 +136,15 @@ export const AuthConfigListResponseSchema = z.object({
136
export type AuthConfigListResponse = z.infer<typeof AuthConfigListResponseSchema>;
137
138
export const AuthCustomConfigUpdateParamsSchema = z.object({
130
- credentials: z.record(z.string(), z.union([z.string(), z.unknown()])),
139
type: z.literal('custom'),
140
+ credentials: z
141
+ .object({
142
+ scopes: z.union([z.string(), z.array(z.string())]).optional(),
143
+ user_scopes: z.union([z.string(), z.array(z.string())]).optional(),
144
+ })
145
+ .passthrough()
146
+ .optional(),
147
+ isEnabledForToolRouter: z.boolean().optional(),
148
/**
149
* @deprecated - use tool access config to determine the tools that the user can perform on the auth config.
150
*/
@@ -137,8 +153,9 @@ export const AuthCustomConfigUpdateParamsSchema = z.object({
153
});
154
155
export const AuthDefaultConfigUpdateParamsSchema = z.object({
140
- scopes: z.string().optional(),
156
type: z.literal('default'),
157
+ scopes: z.string().optional(),
158
+ isEnabledForToolRouter: z.boolean().optional(),
159
/**
160
* @deprecated - use tool access config to determine the tools that the user can perform on the auth config.
161
*/
ts/packages/core/src/utils/transformers/authConfigs.ts
+1
@@ -40,6 +40,7 @@ export function transformAuthConfigRetrieveResponse(
40
logo: authConfig.toolkit.logo,
41
slug: authConfig.toolkit.slug,
42
},
43
+ isEnabledForToolRouter: authConfig.is_enabled_for_tool_router,
44
uuid: authConfig.uuid,
45
authScheme: authConfig.auth_scheme,
46
credentials: authConfig.credentials,
ts/packages/core/test/AuthConfigs/authConfigs.test.ts
+36
-1
@@ -2,7 +2,6 @@ import { describe, it, expect, vi, beforeEach } from 'vitest';
2
import { AuthConfigs } from '../../src/models/AuthConfigs';
3
import ComposioClient from '@composio/client';
4
import { ValidationError } from '../../src/errors/ValidationErrors';
5
-import { ZodError } from 'zod/v3';
5
import {
6
AuthConfigRetrieveResponse as ComposioAuthConfigRetrieveResponse,
7
AuthConfigDeleteResponse,
@@ -398,6 +397,42 @@ describe('AuthConfigs', () => {
397
398
await expect(authConfigs.get('nonexistent_auth')).rejects.toThrow('Auth config not found');
399
});
400
+
401
+ it('should retrieve auth config with isEnabledForToolRouter set to true', async () => {
402
+ const responseWithToolRouter = {
403
+ ...mockComposioAuthConfigResponse,
404
+ is_enabled_for_tool_router: true,
405
+ };
406
+ mockClient.authConfigs.retrieve.mockResolvedValueOnce(responseWithToolRouter);
407
+
408
+ const result = await authConfigs.get('auth_12345');
409
+
410
+ expect(result.isEnabledForToolRouter).toBe(true);
411
+ });
412
+
413
+ it('should retrieve auth config with isEnabledForToolRouter set to false', async () => {
414
+ const responseWithoutToolRouter = {
415
+ ...mockComposioAuthConfigResponse,
416
+ is_enabled_for_tool_router: false,
417
+ };
418
+ mockClient.authConfigs.retrieve.mockResolvedValueOnce(responseWithoutToolRouter);
419
+
420
+ const result = await authConfigs.get('auth_12345');
421
+
422
+ expect(result.isEnabledForToolRouter).toBe(false);
423
+ });
424
+
425
+ it('should retrieve auth config with isEnabledForToolRouter undefined', async () => {
426
+ const responseWithoutField = {
427
+ ...mockComposioAuthConfigResponse,
428
+ is_enabled_for_tool_router: undefined,
429
+ };
430
+ mockClient.authConfigs.retrieve.mockResolvedValueOnce(responseWithoutField);
431
+
432
+ const result = await authConfigs.get('auth_12345');
433
+
434
+ expect(result.isEnabledForToolRouter).toBeUndefined();
435
+ });
436
});
437
438
describe('update', () => {
uv.lock
+14
-14
@@ -477,7 +477,7 @@ wheels = [
477
478
[[package]]
479
name = "composio"
480
-version = "0.10.5"
480
+version = "0.10.6"
481
source = { virtual = "python" }
482
dependencies = [
483
{ name = "composio-client" },
@@ -506,7 +506,7 @@ dev = [
506
507
[package.metadata]
508
requires-dist = [
509
- { name = "composio-client", specifier = "==1.25.0" },
509
+ { name = "composio-client", specifier = "==1.26.0" },
510
{ name = "openai" },
511
{ name = "pydantic", specifier = ">=2.6.4" },
512
{ name = "pysher", specifier = ">=1.0.8" },
@@ -532,7 +532,7 @@ dev = [
532
533
[[package]]
534
name = "composio-anthropic"
535
-version = "0.10.5"
535
+version = "0.10.6"
536
source = { virtual = "python/providers/anthropic" }
537
dependencies = [
538
{ name = "anthropic" },
@@ -547,7 +547,7 @@ requires-dist = [
547
548
[[package]]
549
name = "composio-client"
550
-version = "1.25.0"
550
+version = "1.26.0"
551
source = { registry = "https://pypi.org/simple" }
552
dependencies = [
553
{ name = "anyio" },
@@ -557,14 +557,14 @@ dependencies = [
557
{ name = "sniffio" },
558
{ name = "typing-extensions" },
559
]
560
-sdist = { url = "https://files.pythonhosted.org/packages/c4/72/270a24236f4580d1eced2eb4b38c4a9bd399714ef2b76c74952729687276/composio_client-1.25.0.tar.gz", hash = "sha256:ae335bc90309b9d5f222c48c85a20a4c701afda5e3015cb3472245c01aa632bb", size = 190472 }
560
+sdist = { url = "https://files.pythonhosted.org/packages/31/ea/e9abfe0a16b10358ea126fae9019808cde5d76fdf17b70cc1df48c7535b6/composio_client-1.26.0.tar.gz", hash = "sha256:8ab65d900025970760c522c8df4445a6a63aff9f78773682f7193928016fb0f7", size = 192874 }
561
wheels = [
562
- { url = "https://files.pythonhosted.org/packages/56/0b/9f92a8b2bce0a23f39c98e860fe14e58365d804c0dea8277ed6b4e5e66f4/composio_client-1.25.0-py3-none-any.whl", hash = "sha256:de6b05667f29692a4425b43d53349c7b31439012ffc3f93059ceacb5cc3fbe56", size = 209162 },
562
+ { url = "https://files.pythonhosted.org/packages/37/2b/ad19b251f0d2241da0227fce6aee5792a6bbf26c09ff1d43841b946e7557/composio_client-1.26.0-py3-none-any.whl", hash = "sha256:24b6b0ffba0b7a1c818da53a77b450bbddc26313f9c6abc1ef4472cfb348e450", size = 210074 },
563
]
564
565
[[package]]
566
name = "composio-crewai"
567
-version = "0.10.5"
567
+version = "0.10.6"
568
source = { virtual = "python/providers/crewai" }
569
dependencies = [
570
{ name = "composio" },
@@ -579,7 +579,7 @@ requires-dist = [
579
580
[[package]]
581
name = "composio-gemini"
582
-version = "0.10.5"
582
+version = "0.10.6"
583
source = { virtual = "python/providers/gemini" }
584
dependencies = [
585
{ name = "composio" },
@@ -594,7 +594,7 @@ requires-dist = [
594
595
[[package]]
596
name = "composio-google"
597
-version = "0.10.5"
597
+version = "0.10.6"
598
source = { virtual = "python/providers/google" }
599
dependencies = [
600
{ name = "composio" },
@@ -609,7 +609,7 @@ requires-dist = [
609
610
[[package]]
611
name = "composio-google-adk"
612
-version = "0.10.5"
612
+version = "0.10.6"
613
source = { virtual = "python/providers/google_adk" }
614
dependencies = [
615
{ name = "composio" },
@@ -624,7 +624,7 @@ requires-dist = [
624
625
[[package]]
626
name = "composio-langchain"
627
-version = "0.10.5"
627
+version = "0.10.6"
628
source = { virtual = "python/providers/langchain" }
629
dependencies = [
630
{ name = "composio" },
@@ -639,7 +639,7 @@ requires-dist = [
639
640
[[package]]
641
name = "composio-openai"
642
-version = "0.10.5"
642
+version = "0.10.6"
643
source = { virtual = "python/providers/openai" }
644
dependencies = [
645
{ name = "composio" },
@@ -654,7 +654,7 @@ requires-dist = [
654
655
[[package]]
656
name = "composio-openai-agents"
657
-version = "0.10.5"
657
+version = "0.10.6"
658
source = { virtual = "python/providers/openai_agents" }
659
dependencies = [
660
{ name = "composio" },
@@ -892,7 +892,7 @@ dev = [
892
requires-dist = [
893
{ name = "click", specifier = ">=8.1.7" },
894
{ name = "composio", virtual = "python" },
895
- { name = "composio-client", specifier = "==1.25.0" },
895
+ { name = "composio-client", specifier = "==1.26.0" },
896
{ name = "composio-gemini", virtual = "python/providers/gemini" },
897
{ name = "composio-langchain", virtual = "python/providers/langchain" },
898
{ name = "composio-openai", virtual = "python/providers/openai" },