Skip to main content

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


Download files

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

Source Distribution

cortexflow_sdk-0.1.2.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cortexflow_sdk-0.1.2-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

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

Hashes for cortexflow_sdk-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a49ec0570cca252846b6127c929e92a09a1be563364a04572014a0447f861a5b
MD5 8738b0741792b6d1e2563a73f9bcd800
BLAKE2b-256 652a2b104de540765e94ab3cb03bceb1166bb37003194a40e31f40cf0efe56fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for cortexflow_sdk-0.1.2.tar.gz:

Publisher: publish-pypi.yml on TheAmitChandra/CortexFlow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for cortexflow_sdk-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5c20c40a79d0dfd51165602fc8b66aeb05955d1f61026b356ef6277c8049a4c3
MD5 5b658249acac7adcf45ced22753a9470
BLAKE2b-256 622242ec806b7acb8fc44c9c51b5f4f533a42d050b2ef5088d11bbdf5984f3ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for cortexflow_sdk-0.1.2-py3-none-any.whl:

Publisher: publish-pypi.yml on TheAmitChandra/CortexFlow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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