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 21, 04:45 UTC
| 1 | --- |
| 2 | title: "Toolkits" |
| 3 | description: "Toolkits are a collectiono of tools that can be used to perform various tasks. They're conceptualized as a set of tools. Ex: Github toolkit can per..." |
| 4 | --- |
| 5 | |
| 6 | ## Methods |
| 7 | |
| 8 | ### list() |
| 9 | |
| 10 | List all toolkits. |
| 11 | |
| 12 | ```python |
| 13 | def list(*, category: str | None = ..., cursor: str | None = ..., limit: float | None = ..., sort_by: Literal['usage', 'alphabetically'] | None = ..., managed_by: Literal['composio', 'all', 'project'] | None = ...) -> toolkit_list_response.ToolkitListResponse |
| 14 | ``` |
| 15 | |
| 16 | **Parameters** |
| 17 | |
| 18 | | Name | Type | |
| 19 | |------|------| |
| 20 | | `category?` | `str \| None` | |
| 21 | | `cursor?` | `str \| None` | |
| 22 | | `limit?` | `float \| None` | |
| 23 | | `sort_by?` | `Literal['usage', 'alphabetically'] \| None` | |
| 24 | | `managed_by?` | `Literal['composio', 'all', 'project'] \| None` | |
| 25 | |
| 26 | **Returns** |
| 27 | |
| 28 | `toolkit_list_response.ToolkitListResponse` |
| 29 | |
| 30 | --- |
| 31 | |
| 32 | ### get() |
| 33 | |
| 34 | ```python |
| 35 | def get(slug: str | None = ..., *, query: toolkit_list_params.ToolkitListParams | None = ...) -> Union[toolkit_retrieve_response.ToolkitRetrieveResponse, ... |
| 36 | ``` |
| 37 | |
| 38 | **Parameters** |
| 39 | |
| 40 | | Name | Type | |
| 41 | |------|------| |
| 42 | | `slug?` | `str \| None` | |
| 43 | | `query?` | `toolkit_list_params.ToolkitListParams \| None` | |
| 44 | |
| 45 | **Returns** |
| 46 | |
| 47 | `Union[toolkit_retrieve_response.ToolkitRetrieveResponse, ...` |
| 48 | |
| 49 | --- |
| 50 | |
| 51 | ### get_many() |
| 52 | |
| 53 | Fetch several toolkits by slug in one request. |
| 54 | |
| 55 | ```python |
| 56 | def get_many(slugs: Sequence[str], *, category: str | None = ..., managed_by: Literal['composio', 'all', 'project'] | None = ..., sort_by: Literal['usage', 'alphabetically'] | None = ..., limit: float | None = ..., cursor: str | None = ...) -> List[Any] |
| 57 | ``` |
| 58 | |
| 59 | **Parameters** |
| 60 | |
| 61 | | Name | Type | Description | |
| 62 | |------|------|-------------| |
| 63 | | `slugs` | `Sequence[str]` | The toolkit slugs to fetch. | |
| 64 | | `category?` | `str \| None` | Only return toolkits in this category. | |
| 65 | | `managed_by?` | `Literal['composio', 'all', 'project'] \| None` | Filter by who manages the toolkit. | |
| 66 | | `sort_by?` | `Literal['usage', 'alphabetically'] \| None` | Sort order of the returned toolkits. | |
| 67 | | `limit?` | `float \| None` | Maximum number of toolkits to return. | |
| 68 | | `cursor?` | `str \| None` | Pagination cursor from a previous response. | |
| 69 | |
| 70 | **Returns** |
| 71 | |
| 72 | `List[Any]` — The matching toolkits. |
| 73 | |
| 74 | **Example** |
| 75 | |
| 76 | ```python |
| 77 | toolkits = composio.toolkits.get_many(["github", "slack"]) |
| 78 | for toolkit in toolkits: |
| 79 | print(toolkit.slug, toolkit.name) |
| 80 | ``` |
| 81 | |
| 82 | --- |
| 83 | |
| 84 | ### changelog() |
| 85 | |
| 86 | Retrieve the toolkit changelog (the last 10 versions per toolkit). |
| 87 | |
| 88 | ```python |
| 89 | def changelog() -> toolkit_retrieve_changelog_response.ToolkitRetrieveChange... |
| 90 | ``` |
| 91 | |
| 92 | **Returns** |
| 93 | |
| 94 | `toolkit_retrieve_changelog_response.ToolkitRetrieveChange...` — The changelog entries under `.items`. |
| 95 | |
| 96 | **Example** |
| 97 | |
| 98 | ```python |
| 99 | changelog = composio.toolkits.changelog() |
| 100 | for entry in changelog.items: |
| 101 | print(entry.slug, [v.version for v in entry.versions]) |
| 102 | ``` |
| 103 | |
| 104 | --- |
| 105 | |
| 106 | ### recommend_scopes() |
| 107 | |
| 108 | Recommend the OAuth scopes to request so a connection can run the given tools. Experimental — the API marks this endpoint beta. |
| 109 | |
| 110 | ```python |
| 111 | def recommend_scopes(toolkit_slug: str, **params: Unpack[toolkit_recommend_scopes_params.ToolkitRecommendScopesParams]) -> toolkit_recommend_scopes_response.ToolkitRecommendScopesR... |
| 112 | ``` |
| 113 | |
| 114 | **Parameters** |
| 115 | |
| 116 | | Name | Type | Description | |
| 117 | |------|------|-------------| |
| 118 | | `toolkit_slug` | `str` | The toolkit to recommend scopes for. | |
| 119 | | `params?` | `Unpack[toolkit_recommend_scopes_params.ToolkitRecommendScopesParams]` | | |
| 120 | |
| 121 | **Returns** |
| 122 | |
| 123 | `toolkit_recommend_scopes_response.ToolkitRecommendScopesR...` — The `least_privilege` and `fewest` scope sets plus the `conditional` scopes, under `.scopes`. |
| 124 | |
| 125 | **Example** |
| 126 | |
| 127 | ```python |
| 128 | recommendation = composio.toolkits.recommend_scopes( |
| 129 | "gmail", |
| 130 | tools=["GMAIL_SEND_EMAIL", "GMAIL_FETCH_EMAILS"], |
| 131 | ) |
| 132 | print(recommendation.scopes.least_privilege) |
| 133 | ``` |
| 134 | |
| 135 | --- |
| 136 | |
| 137 | ### list_grant_contexts() |
| 138 | |
| 139 | List the grant-context dimensions a toolkit's scope recommendation depends on, with their allowed values and the default the API assumes. Experimental — the API marks this endpoint beta. |
| 140 | |
| 141 | ```python |
| 142 | def list_grant_contexts(toolkit_slug: str, **params: Unpack[toolkit_retrieve_scopes_grant_context_params.ToolkitRetrieveScopesGrantContextParams]) -> toolkit_retrieve_scopes_grant_context_response.ToolkitRet... |
| 143 | ``` |
| 144 | |
| 145 | **Parameters** |
| 146 | |
| 147 | | Name | Type | Description | |
| 148 | |------|------|-------------| |
| 149 | | `toolkit_slug` | `str` | The toolkit to list grant contexts for. | |
| 150 | | `params?` | `Unpack[toolkit_retrieve_scopes_grant_context_params.ToolkitRetrieveScopesGrantContextParams]` | | |
| 151 | |
| 152 | **Returns** |
| 153 | |
| 154 | `toolkit_retrieve_scopes_grant_context_response.ToolkitRet...` — `grant_context_dimensions` and `default_grant_context`. |
| 155 | |
| 156 | **Example** |
| 157 | |
| 158 | ```python |
| 159 | contexts = composio.toolkits.list_grant_contexts("gmail") |
| 160 | for dimension in contexts.grant_context_dimensions: |
| 161 | print(dimension.dimension, dimension.values) |
| 162 | ``` |
| 163 | |
| 164 | --- |
| 165 | |
| 166 | ### list_categories() |
| 167 | |
| 168 | List all categories of toolkits. |
| 169 | |
| 170 | ```python |
| 171 | def list_categories() |
| 172 | ``` |
| 173 | |
| 174 | --- |
| 175 | |
| 176 | ### authorize() |
| 177 | |
| 178 | Authorize a user to a toolkit If auth config is not found, it will be created using composio managed auth. |
| 179 | |
| 180 | ```python |
| 181 | def authorize(*, user_id: str, toolkit: str) |
| 182 | ``` |
| 183 | |
| 184 | **Parameters** |
| 185 | |
| 186 | | Name | Type | Description | |
| 187 | |------|------|-------------| |
| 188 | | `user_id` | `str` | The ID of the user to authorize. | |
| 189 | | `toolkit` | `str` | The slug of the toolkit to authorize. | |
| 190 | |
| 191 | --- |
| 192 | |
| 193 | ### get_connected_account_initiation_fields() |
| 194 | |
| 195 | Get the required property for a given toolkit and auth scheme. |
| 196 | |
| 197 | ```python |
| 198 | def get_connected_account_initiation_fields(toolkit: str, auth_scheme: AuthSchemeL, required_only: bool = ...) -> AuthFieldsT |
| 199 | ``` |
| 200 | |
| 201 | **Parameters** |
| 202 | |
| 203 | | Name | Type | |
| 204 | |------|------| |
| 205 | | `toolkit` | `str` | |
| 206 | | `auth_scheme` | `AuthSchemeL` | |
| 207 | | `required_only?` | `bool` | |
| 208 | |
| 209 | **Returns** |
| 210 | |
| 211 | `AuthFieldsT` |
| 212 | |
| 213 | --- |
| 214 | |
| 215 | ### get_auth_config_creation_fields() |
| 216 | |
| 217 | Get the required property for a given toolkit and auth scheme. |
| 218 | |
| 219 | ```python |
| 220 | def get_auth_config_creation_fields(toolkit: str, auth_scheme: AuthSchemeL, required_only: bool = ...) -> AuthFieldsT |
| 221 | ``` |
| 222 | |
| 223 | **Parameters** |
| 224 | |
| 225 | | Name | Type | |
| 226 | |------|------| |
| 227 | | `toolkit` | `str` | |
| 228 | | `auth_scheme` | `AuthSchemeL` | |
| 229 | | `required_only?` | `bool` | |
| 230 | |
| 231 | **Returns** |
| 232 | |
| 233 | `AuthFieldsT` |
| 234 | |
| 235 | --- |
| 236 | |
| 237 | [View source](https://github.com/composiohq/composio/blob/next/python/composio/core/models/toolkits.py#L33) |