Skip to main content

kin-kernel contain the default templates of Cells that compose a Kin.

Project description

📖 DigitalKin.ai - KinKernel

PyPI version Python version License: CC BY-NC-SA 4.0 DigitalKin Discord

Welcome to the DigitalKin KinKernel ! This package is designed to enable developers to create Cells, which are autonomous agents that can be integrated into the Internet of Agents (IoA) ecosystem powered by DigitalKin.

👀 Overview

The KinKernel provides a framework for creating and managing Cells. Each Cell represents a distinct autonomous agent with a specific role and behavior within the IoA. The KinKernel ensures that all Cells adhere to a standard interface and can communicate effectively within the ecosystem.

💡 Features

  • Abstract base classes for standardizing Cell creation
  • Response models for consistent communication
  • Helper methods for schema information access
  • Configuration management
  • Example Cell implementation

🛠️ Installation

Before installing the KinKernel, ensure you have Python installed on your system. This package requires Python 3.10 or higher.

To install the KinKernel With pipy:

pip install kin-kernel

Or clone the repository and install the dependencies:

git clone https://github.com/DigitalKin/kin-kernel.git
cd kin-kernel-kit
pip install -r requirements/prod.txt

For development purposes, you may also want to install the development dependencies:

pip install -r requirements/dev.txt

✨ Linter

Execute linters:

   flake8 kinkernel
   black kinkernel --check --diff
   black kinkernel
   mypy kinkernel
   pylint kinkernel

💻 Usage

To create a new Cell, you'll need to subclass the Cell class provided in the kinKernel and implement the required methods and properties.

Here's a simple example of a Cell that processes input data:

from pydantic import BaseModel

from kinkernel import Cell
from kinkernel.config import ConfigModel, EnvVar


class MyInputModel(BaseModel):
    value1: int
    value2: str


class MyOutputModel(BaseModel):
    processed_value: int


class MyCell(Cell[MyInputModel, MyOutputModel]):
    role = "Processor"
    description = "Processes input data"
    input_format = MyInputModel
    output_format = MyOutputModel
    config = ConfigModel(
        env_vars=[
            EnvVar(key="ENV_VAR_1", value="value1"),
            EnvVar(key="ENV_VAR_2", value="value2"),
        ]
    )

    async def _execute(self, input_data: MyInputModel) -> MyOutputModel:
        # Process the input_data as needed
        exec_result = {"processed_value": input_data.value1 * 2}
        return MyOutputModel(**exec_result)

You can then instantiate and execute your Cell as follows:

my_cell = MyCell()
input_data = MyInputModel(value1=10, value2="example")
output_data = my_cell.execute(input_data)
print(output_data)

For a more detailed example, refer to the examples/simple_cell_example.py file in the repository.

🧪 Testing

The CDK comes with a set of unit tests to ensure that your Cells work as expected. To run the tests, execute the following command:

pytest

👥 Contribution

Contributions to the KinKernel are welcome! If you have suggestions for improvements or find any issues, please open an issue on our GitHub repository.

🤗 Support

If you have any questions or need support with the KinKernel, please reach out to us at contact@digitalkin.ai.

Thank you for using the DigitalKin Cell Development Kit. We look forward to seeing the innovative Cells you'll create for the Internet of Agents!


Kin-kernel © 2023 by DigitalKin is licensed under CC BY-NC-SA 4.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kin-kernel-0.0.4.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

kin_kernel-0.0.4-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

Details for the file kin-kernel-0.0.4.tar.gz.

File metadata

  • Download URL: kin-kernel-0.0.4.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for kin-kernel-0.0.4.tar.gz
Algorithm Hash digest
SHA256 cc028c0bb1f9f6c72f8c252ab28f40944ecf1c6c45b13397069d82a8aa935426
MD5 82d19e3946cd5d2ae3988c3d8ac52f9d
BLAKE2b-256 aaf1fcac139aa63dd6a3b6a3e35f644d772479d4a18f0cba6bda3db76b861878

See more details on using hashes here.

File details

Details for the file kin_kernel-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: kin_kernel-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 23.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for kin_kernel-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6573eea2416765f82b96d7821a7c88f6ec260b220dd1ad8e0e0597edb19ea328
MD5 c8454c6709ebdd0f7b518c7f72eca23b
BLAKE2b-256 4536764e825efe8c0a3cd525e522f5084c63be3abac7ff7cf9547c7b30779fdb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page