Skip to main content

SDK for building third-party automations for the ToRivers marketplace

Project description

ToRivers SDK

Build and publish automations for the ToRivers marketplace.

Installation

pip install torivers-sdk

Quick Start

Create a new automation:

from torivers_sdk import Automation, AutomationMetadata, BaseState
from langgraph.graph import StateGraph
from typing import Annotated, Any


class MyState(BaseState):
    """State for my automation."""
    result: Annotated[str, lambda l, r: r]


class MyAutomation(Automation[MyState]):
    """A simple automation example."""

    def metadata(self) -> AutomationMetadata:
        return AutomationMetadata(
            name="my-automation",
            title="My Automation",
            version="1.0.0",
            description="Does something useful",
            category="general",
        )

    def get_state_class(self) -> type[MyState]:
        return MyState

    def build_graph(self) -> StateGraph:
        graph = StateGraph(MyState)
        graph.add_node("process", self.process)
        graph.set_entry_point("process")
        graph.set_finish_point("process")
        return graph

    def process(self, state: MyState) -> dict[str, Any]:
        context = state["context"]
        context.log_progress("Processing", "Starting work...")

        # Your automation logic here
        result = f"Processed: {state['input_data']}"

        context.log_success("Done", "Work completed!")
        return {
            "output_data": {
                "_version": 1,
                "_blocks": [
                    {
                        "type": "text",
                        "label": "Result",
                        "content": result,
                        "format": "plain",
                    }
                ],
            }
        }

Testing Locally

Use the local sandbox to test your automation:

import asyncio
from torivers_sdk.testing import LocalSandbox, MockCredentialProxy

async def test_automation():
    sandbox = LocalSandbox()

    # Set up mock credentials if needed
    credentials = MockCredentialProxy(["gmail", "sheets"])
    sandbox.set_credentials(credentials)

    # Run the automation
    automation = MyAutomation()
    result = await sandbox.run(automation, {"query": "test"})

    assert result.success
    print(f"Output: {result.output_data}")

asyncio.run(test_automation())

CLI Commands

# Initialize a new automation project
torivers init my-automation

# Run locally
torivers run --input input.json

# Run tests
torivers test

# Validate before submission
torivers validate

# Submit for review
torivers submit

# Authenticate and track review
torivers login
torivers status

Documentation

For full documentation, visit docs.torivers.com/sdk

Versioning & Releases

This package uses bump-my-version for version management. Install dev dependencies first:

pip install -e ".[dev]"

Bump the version (creates a commit + sdk-v* tag automatically):

bump-my-version bump patch                   # 0.1.0 → 0.1.1
bump-my-version bump minor                   # 0.1.0 → 0.2.0
bump-my-version bump --new-version 0.2.0b6   # Example beta version
bump-my-version bump pre_n                   # Next beta (b1 → b2)
bump-my-version bump pre_l                   # Beta → RC → Stable

Then push to trigger the PyPI publish workflow:

git push && git push --tags

Pre-releases (b/rc tags) are published to PyPI but not installed by default — users must pip install --pre torivers-sdk.

Requirements

  • Python 3.11+
  • Dependencies: langgraph, pydantic, httpx, click, rich, docker, pyyaml

License

Proprietary - see LICENSE for details.

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

torivers_sdk-0.2.0b7.tar.gz (168.7 kB view details)

Uploaded Source

Built Distribution

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

torivers_sdk-0.2.0b7-py3-none-any.whl (160.8 kB view details)

Uploaded Python 3

File details

Details for the file torivers_sdk-0.2.0b7.tar.gz.

File metadata

  • Download URL: torivers_sdk-0.2.0b7.tar.gz
  • Upload date:
  • Size: 168.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for torivers_sdk-0.2.0b7.tar.gz
Algorithm Hash digest
SHA256 81a7a447746c481a09fceca486de416d3f65aa32a2888d747ddbb4291f70b613
MD5 f4fa02eb02b9535e60f7db849d78030b
BLAKE2b-256 e2711546f757abcfb4f38e645cd476fe0a2d5f65b5834cc261cce9c8e2cf74cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for torivers_sdk-0.2.0b7.tar.gz:

Publisher: sdk-publish.yml on Lo-Agency/torivers-v2

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

File details

Details for the file torivers_sdk-0.2.0b7-py3-none-any.whl.

File metadata

  • Download URL: torivers_sdk-0.2.0b7-py3-none-any.whl
  • Upload date:
  • Size: 160.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for torivers_sdk-0.2.0b7-py3-none-any.whl
Algorithm Hash digest
SHA256 5e510b330ecfbce4c9d2ba8f6213dd2471200505aa626a77f5855ad7a5c3fcbc
MD5 7a1d0040222ad82317c9e6b0849c558c
BLAKE2b-256 13adcf8ce43f8f86bfea7d668276d850c4f04bfa3d6e4db626a526a94a3dc67a

See more details on using hashes here.

Provenance

The following attestation bundles were made for torivers_sdk-0.2.0b7-py3-none-any.whl:

Publisher: sdk-publish.yml on Lo-Agency/torivers-v2

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