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.1.tar.gz (8.4 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.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file cortexflow_sdk-0.1.1.tar.gz.

File metadata

  • Download URL: cortexflow_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 8.4 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.1.tar.gz
Algorithm Hash digest
SHA256 94edf30dcb5efc1fc0475192e619e8bd4753abf99c48190dfc1df65425612f02
MD5 02158ffb141e6dd76d8238ccd9d1c776
BLAKE2b-256 45f342fdf760baa6763cb2961c60c25e54cd60d11156d3879e75b8e01e1854b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for cortexflow_sdk-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: cortexflow_sdk-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 128191a221db06d7c7bd14ce54ff2b08608fd6c604d33cbb997ebb026cb03eef
MD5 601172dc997848cf79cb88fcc29489f8
BLAKE2b-256 65dfb97ea0091b3da63192816f6e226e47c27bf2ddd76588306255a623d28702

See more details on using hashes here.

Provenance

The following attestation bundles were made for cortexflow_sdk-0.1.1-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