Kit Agent SDK
https://pypi.org/project/kitagentsdk/
The kitagentsdk is a Python library that provides a standardized, high-level framework for developing agents for the Kit platform. It is designed to abstract away the boilerplate of platform integration, allowing developers to focus entirely on their agent's core logic.
This package includes both the SDK (the kitagentsdk library) and a command-line interface (kitagentcli) to accelerate development.
Key Features
- Rapid Scaffolding: Use the
kitagentclito generate a complete, working agent project in a single command. - Standardized Agent Structure: The
BaseAgentclass provides a clear and consistent structure for all agents. - Simplified Platform Interaction: A rich set of helper methods for logging, metrics, progress reporting, and data fetching that automatically communicate with the Kit platform.
- Local Testing: Agents are fully runnable on a local machine, enabling rapid testing and debugging.
Installation
The SDK and CLI are distributed as a single package on PyPI.
pip install kitagentsdk
Getting Started: Creating a New Agent
The fastest way to get started is by using the kitagentcli.
1. Create a New Agent Project
Run the new command to scaffold a new project directory.
kitagentcli new my-trading-agent
This creates a new folder named my-trading-agent with a clean, working structure:
├── .gitignore
├── README.md
├── manifest.json
├── requirements.txt
└── main.py
2. Implement Your Agent's Logic
Open main.py. The generated file provides a clear starting point for your agent's training logic, demonstrating the key SDK features.
3. Run Your Agent Locally
You can test your agent's train command directly on your local machine.
# Create a dummy config file (to simulate what the platform provides)
echo '{"total_steps": 100, "learning_rate": 0.01}' > config.json
# Create a directory for output
mkdir ./_output
# Run the agent's training script
python main.py train --config config.json --output-path ./_output
You will see your agent's log messages printed to the console, and the _output directory will contain the generated model.zip artifact and metrics.log file.
The BaseAgent API
All agents must inherit from kitagentsdk.BaseAgent. This base class provides the following helpers:
Core Properties
self.config: A dictionary containing the configuration parameters for the current run, as defined inmanifest.jsonand customized at runtime in the UI.self.output_path: Apathlib.Pathobject pointing to the directory where all artifacts, models, and metrics must be saved (e.g.,./_outputlocally, or a temporary path when run bykitexec).
UI and Platform Integration Methods
These methods are the primary way your agent communicates its state back to the Kit UI.
-
self.log(message: str): Prints a message to the agent's execution log, which is streamed in real-time to the training detail page in the UI. Use this for all status updates and important events. -
self.record_metric(name: str, step: int, value: float): Records a time-series data point. These are automatically collected and visualized as charts in the UI.- Pro Tip: Use a
group/nameconvention (e.g.,performance/sharpe_ratio) to automatically group related charts under a common heading in the UI.
- Pro Tip: Use a
-
self.report_progress(step: int): Reports the agent's current step count. This updates the progress bars for the run and the overall training in the UI. It is highly recommended to call this frequently (e.g., on every step) via a callback.
The Kit API Client: self.kit
The self.kit object is an instance of KitClient that handles authenticated communication with the Kit backend API.
-
self.kit.get_training_data(params: dict) -> dict | None: Requests a fully prepared, feature-enriched, and bias-corrected training dataset. This is the standard way for agents to receive market data.# Example usage inside your environment params = { "symbol": "YM", "start_date": "2020-01-01", "end_date": "2021-01-01", "features": self.config.get("features", []) # From manifest.json } data_json = self.kit.get_training_data(params) # data_json will contain 'short', 'mid', and 'long' timescale dataframes
-
self.kit.download_artifact(artifact_id: UUID, destination_path: str) -> bool: Downloads an artifact from a previous run. This is essential for multi-stage training, allowing a fine-tuning stage to download themodel.zipornorm_stats.jsonfrom a pre-training stage. The required artifact IDs are automatically injected intoself.configby the backend.
Standardized Artifacts
To enable automatic stage transitions, the platform expects two standardized artifact types:
model.zip: The primary output of any training stage (e.g., the saved SB3 model).norm_stats.json: A JSON file containing feature normalization statistics, typically only generated during a pre-training stage.
Your agent should save its final outputs using these filenames in self.output_path. The kitexec worker will automatically assign the correct type when uploading them.
The manifest.json File
This file provides the Kit platform with metadata about your agent.
name,description: Basic info displayed in the UI.parameters: Defines the hyperparameters and environment settings that will be exposed to the user in the "Create New Training" wizard.default_features: A list of features the agent requires. These are used byself.kit.get_training_data.default_training: Defines the default multi-stage training plan, including the configuration for each stage.
The kitagentcli
A command-line tool to accelerate development.
kitagentcli new <project_name>: Scaffolds a complete, ready-to-run agent project in a new directory named<project_name>.
Metadata
Release files for kitagentsdk 0.3.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| kitagentsdk-0.3.4.tar.gz | 23.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kitagentsdk-0.3.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 49.4 kB
Release files / kitagentsdk-0.3.4.tar.gz
| Download URL | kitagentsdk-0.3.4.tar.gz |
|---|---|
| Size | 23.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a7ebe78480f9ce9e7f7edc3fff8a27160967839f68ba38891d9f02d319fe1001
|
|
BLAKE2b-256 checksum How to use checksums |
56c6b520338f96f21e5701fd8e29f6d0a7df3eedf4cd5018ecf7d1d1a9049f1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.11
|
Release files / kitagentsdk-0.3.4-py3-none-any.whl
| Download URL | kitagentsdk-0.3.4-py3-none-any.whl |
|---|---|
| Size | 25.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
392ac7dd1e28e2ad02c88b273fffc2878f02ed5f8b2751fabd2e3fff8ec7f96d
|
|
BLAKE2b-256 checksum How to use checksums |
685b6b4e0b339a29b3c31cceb21dbd75cb2f7f3aeac7e2a9631cb7279121aa81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.11
|
Security for kitagentsdk 0.3.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.