Typed interfaces for building CortexFlow plugins, tools, and channel adapters — no gateway dependencies required.
Project description
cortexflow-sdk
Typed interfaces for building CortexFlow plugins — without installing the full gateway.
CortexFlow's gateway depends on FastAPI, Redis, Qdrant, and SDKs for all 14 supported channels. None of that is needed to write a plugin — only to run the gateway that loads it. This package contains just the three base classes a plugin author needs, with zero third-party dependencies.
Install
pip install cortexflow-sdk
Writing a plugin
Every plugin package registers a Plugin subclass via a cortexflow.plugins
entry point:
# my_plugin/plugin.py
from cortexflow_sdk import Plugin, PluginMetadata, Tool, ToolResult
class WeatherTool(Tool):
name = "get_weather"
description = "Get the current weather for a city."
parameters = {
"city": {"type": "str", "description": "City name", "required": True},
}
permissions = ["network"]
async def execute(self, city: str) -> ToolResult:
# ... call a weather API ...
return ToolResult(tool=self.name, output=f"Sunny in {city}")
class WeatherPlugin(Plugin):
metadata = PluginMetadata(
name="cortexflow-weather",
version="1.0.0",
plugin_type="tool",
description="Adds a get_weather tool.",
permissions=["network"],
)
def get_tools(self):
return [WeatherTool()]
# my_plugin/pyproject.toml
[project.entry-points."cortexflow.plugins"]
cortexflow-weather = "my_plugin.plugin:WeatherPlugin"
Once published to PyPI and installed alongside the CortexFlow gateway,
cortex plugin add cortexflow-weather discovers and loads it.
Plugin types
plugin_type |
Implement | Contributes |
|---|---|---|
tool |
get_tools() |
One or more Tool instances |
channel |
get_channel_adapter() |
A ChannelAdapter instance |
tts / stt / memory |
— | Loaded by name; see gateway docs |
generic |
on_load() / on_unload() |
Lifecycle hooks only |
Writing a channel adapter plugin
from cortexflow_sdk import ChannelAdapter, InboundMessage
class MyChannelAdapter(ChannelAdapter):
channel_id = "my_channel"
async def connect(self) -> None: ...
async def disconnect(self) -> None: ...
async def send(self, target, text, *, reply_to=None, attachments=None):
...
async def _on_platform_event(self, raw_event: dict) -> None:
await self._dispatch(InboundMessage(
channel=self.channel_id,
sender_id=raw_event["user_id"],
sender_name=raw_event["user_name"],
text=raw_event["text"],
))
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cortexflow_sdk-0.1.2.tar.gz.
File metadata
- Download URL: cortexflow_sdk-0.1.2.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a49ec0570cca252846b6127c929e92a09a1be563364a04572014a0447f861a5b
|
|
| MD5 |
8738b0741792b6d1e2563a73f9bcd800
|
|
| BLAKE2b-256 |
652a2b104de540765e94ab3cb03bceb1166bb37003194a40e31f40cf0efe56fe
|
Provenance
The following attestation bundles were made for cortexflow_sdk-0.1.2.tar.gz:
Publisher:
publish-pypi.yml on TheAmitChandra/CortexFlow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cortexflow_sdk-0.1.2.tar.gz -
Subject digest:
a49ec0570cca252846b6127c929e92a09a1be563364a04572014a0447f861a5b - Sigstore transparency entry: 1970575342
- Sigstore integration time:
-
Permalink:
TheAmitChandra/CortexFlow@77362bbdb052c352e46f8e7e0bf0122e0593264d -
Branch / Tag:
refs/tags/sdk-v0.1.2 - Owner: https://github.com/TheAmitChandra
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@77362bbdb052c352e46f8e7e0bf0122e0593264d -
Trigger Event:
release
-
Statement type:
File details
Details for the file cortexflow_sdk-0.1.2-py3-none-any.whl.
File metadata
- Download URL: cortexflow_sdk-0.1.2-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c20c40a79d0dfd51165602fc8b66aeb05955d1f61026b356ef6277c8049a4c3
|
|
| MD5 |
5b658249acac7adcf45ced22753a9470
|
|
| BLAKE2b-256 |
622242ec806b7acb8fc44c9c51b5f4f533a42d050b2ef5088d11bbdf5984f3ea
|
Provenance
The following attestation bundles were made for cortexflow_sdk-0.1.2-py3-none-any.whl:
Publisher:
publish-pypi.yml on TheAmitChandra/CortexFlow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cortexflow_sdk-0.1.2-py3-none-any.whl -
Subject digest:
5c20c40a79d0dfd51165602fc8b66aeb05955d1f61026b356ef6277c8049a4c3 - Sigstore transparency entry: 1970575502
- Sigstore integration time:
-
Permalink:
TheAmitChandra/CortexFlow@77362bbdb052c352e46f8e7e0bf0122e0593264d -
Branch / Tag:
refs/tags/sdk-v0.1.2 - Owner: https://github.com/TheAmitChandra
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@77362bbdb052c352e46f8e7e0bf0122e0593264d -
Trigger Event:
release
-
Statement type: