Kaggle

Learn how to use Kaggle with Composio

Overview

SLUG: KAGGLE

Description

Kaggle is a platform for data science and machine learning competitions, offering datasets, notebooks, and a collaborative community.

Authentication Details

generic_api_key
stringRequired

Connecting to Kaggle

Create an auth config

Use the dashboard to create an auth config for the Kaggle toolkit. This allows you to connect multiple Kaggle accounts to Composio for agents to use.

1

Select App

Navigate to Kaggle.

2

Configure Auth Config Settings

Select among the supported auth schemes of and configure them here.

3

Create and Get auth config ID

Click “Create Kaggle Auth Config”. After creation, copy the displayed ID starting with ac_. This is your auth config ID. This is not a sensitive ID — you can save it in environment variables or a database. This ID will be used to create connections to the toolkit for a given user.

Connect Your Account

Using API Key

1from composio import Composio
2
3# Replace these with your actual values
4kaggle_auth_config_id = "ac_YOUR_KAGGLE_CONFIG_ID" # Auth config ID created above
5user_id = "0000-0000-0000" # UUID from database/app
6
7composio = Composio()
8
9def authenticate_toolkit(user_id: str, auth_config_id: str):
10 # Replace this with a method to retrieve an API key from the user.
11 # Or supply your own.
12 user_api_key = input("[!] Enter API key")
13
14 connection_request = composio.connected_accounts.initiate(
15 user_id=user_id,
16 auth_config_id=auth_config_id,
17 config={"auth_scheme": "API_KEY", "val": {"generic_api_key": user_api_key}}
18 )
19
20 # API Key authentication is immediate - no redirect needed
21 print(f"Successfully connected Kaggle for user {user_id}")
22 print(f"Connection status: {connection_request.status}")
23
24 return connection_request.id
25
26
27connection_id = authenticate_toolkit(user_id, kaggle_auth_config_id)
28
29# You can verify the connection using:
30connected_account = composio.connected_accounts.get(connection_id)
31print(f"Connected account: {connected_account}")

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the Kaggle toolkit’s playground

Python
1from composio import Composio
2from openai import OpenAI
3import json
4
5openai = OpenAI()
6composio = Composio()
7
8# User ID must be a valid UUID format
9user_id = "0000-0000-0000" # Replace with actual user UUID from your database
10
11tools = composio.tools.get(user_id=user_id, toolkits=["KAGGLE"])
12
13print("[!] Tools:")
14print(json.dumps(tools))
15
16def invoke_llm(task = "What can you do?"):
17 completion = openai.chat.completions.create(
18 model="gpt-4o",
19 messages=[
20 {
21 "role": "user",
22 "content": task, # Your task here!
23 },
24 ],
25 tools=tools,
26 )
27
28 # Handle Result from tool call
29 result = composio.provider.handle_tool_calls(user_id=user_id, response=completion)
30 print(f"[!] Completion: {completion}")
31 print(f"[!] Tool call result: {result}")
32
33invoke_llm()

Tool List

Tool Name: Download competition data files

Description

Tool to download competition data files. Use after confirming the competition ID.

Action Parameters

force
boolean
id
stringRequired
path
string
quiet
boolean

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Initialize Kaggle Configuration

Description

Tool to initialize Kaggle API client configuration. Attempts CLI first; if unavailable, it falls back to creating ~/.kaggle/kaggle.json (or $KAGGLE_CONFIG_DIR/kaggle.json).

Action Parameters

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Dataset Create

Description

Tool to create a new Kaggle dataset with full metadata. Use after uploading files and finalizing metadata. Returns creation status and message.

Action Parameters

description
string
files
array
id
stringRequired
keywords
array
licenses
arrayRequired
resources
array
subtitle
string
title
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Dataset Status

Description

Tool to get the status of a dataset upload or processing job. Use after uploading a dataset to check processing state.

Action Parameters

dataset_slug
stringRequired
owner_slug
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Dataset Version

Description

Tool to create a new dataset version on Kaggle. Use when you have updated files or metadata and need to publish a new version of an existing dataset.

Action Parameters

category_ids
array
convert_to_csv
booleanDefaults to True
dataset_slug
stringRequired
delete_old_versions
boolean
description
string
files
arrayRequired
owner_slug
stringRequired
subtitle
string
version_notes
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Submit Competition Entry

Description

Tool to submit an entry to a Kaggle competition. Use when you have already uploaded your file and obtained its blob token.

Action Parameters

blob_file_tokens
stringRequired
competition
stringRequired
submission_description
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Kaggle Config Directory

Description

Tool to retrieve the directory of the Kaggle API configuration file. Use when you need to locate the directory containing your kaggle.json credentials.

Action Parameters

override_kaggle_config_dir
string
platform_hint
string
prefer_xdg
boolean
use_fallback_only
boolean
xdg_config_home_override
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Kaggle Config File

Description

Tool to retrieve the filename of the Kaggle API configuration file. Use when you need to find out where the local Kaggle config file is stored before reading or updating.

Action Parameters

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Kaggle Configuration Keys

Description

Tool to list local Kaggle API configuration keys. Use when you need to see which configuration options are set without revealing values.

Action Parameters

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Kaggle Config Path

Description

Tool to retrieve local Kaggle API configuration file path. Use when you need to know the location of the Kaggle config before operations.

Action Parameters

override_kaggle_config_dir
string
platform_hint
string
prefer_xdg
boolean
use_fallback_only
boolean
xdg_config_home_override
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Reset Kaggle Configuration

Description

Tool to reset local Kaggle CLI configuration to defaults. Clears CLI-managed keys ('competition', 'path', 'proxy').

Action Parameters

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Set Kaggle Configuration

Description

Tool to set a Kaggle CLI configuration parameter. Use when updating local CLI settings such as default download path or proxy. Ensure Kaggle CLI is installed.

Action Parameters

name
stringRequired
value
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Unset Kaggle Configuration

Description

Tool to unset a Kaggle CLI configuration parameter. Use when removing local CLI settings such as default download path or proxy. Ensure Kaggle CLI is installed.

Action Parameters

name
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: View Kaggle Configuration

Description

Tool to view local Kaggle API configuration. Use when you need to confirm credentials before API calls.

Action Parameters

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Kaggle Dataset Init

Description

Tool to initialize a dataset-metadata.json file in a local folder. Use when preparing a dataset folder before uploading to Kaggle.

Action Parameters

path
stringDefaults to .

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Kaggle Dataset Files

Description

Tool to list files in a Kaggle dataset. Use when you need to retrieve paginated file listings by owner and dataset slugs, with optional version and paging controls.

Action Parameters

dataset_slug
stringRequired
dataset_version_number
string
owner_slug
stringRequired
page_size
integerDefaults to 20
page_token
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Kaggle Kernel Init

Description

Tool to initialize a kernel-metadata.json file in a local folder. Use when preparing a kernel folder before pushing to Kaggle.

Action Parameters

path
stringDefaults to .

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Download kernel output

Description

Tool to download the output of a Kaggle kernel. Use when needing the latest kernel results locally.

Action Parameters

force
boolean
kernel_slug
stringRequired
path
string
user_name
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Kernel Status

Description

Tool to get the status of a Kaggle kernel run. Use after submitting a kernel to monitor its execution state.

Action Parameters

kernelSlug
stringRequired
userName
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Kaggle Datasets

Description

Tool to list Kaggle datasets with filters and pagination. Use after authenticating with Kaggle API key.

Action Parameters

filetype
stringDefaults to all
group
stringDefaults to public
license
stringDefaults to all
max_size
integer
min_size
integer
page
integerDefaults to 1
search
string
size
string
sort_by
stringDefaults to hottest
tagids
string
user
string

Action Response

data
arrayRequired
error
string
successful
booleanRequired