STROT SDK — Build tools, agents, and pipelines for your STROT instance
Project description
STROT SDK
Build tools, agents, pipelines, and dashboards for your STROT instance — in Python.
Installation
pip install strot-sdk
# With CLI (login, init, deploy commands)
pip install strot-sdk[cli]
# With pandas support (query_df)
pip install strot-sdk[pandas]
# Everything
pip install strot-sdk[cli,pandas]
Quick Start
# 1. Authenticate
strot login
# 2. Scaffold a project
strot init tool my-calculator
# 3. Edit main.py (use Claude Code, Cursor, or any editor)
cd my-calculator
# 4. Test locally
strot test
# 5. Deploy to your STROT instance
strot deploy
SDK Reference
Tools (@function)
from strot_sdk import function, llm
@function(
name='calculate_roi',
description='Calculate return on investment',
category='finance',
parameters=[
{'name': 'cost', 'type': 'number', 'description': 'Total cost'},
{'name': 'revenue', 'type': 'number', 'description': 'Total revenue'},
],
returns={'type': 'number', 'description': 'ROI percentage'}
)
class CalculateROI:
def run(self, cost: float, revenue: float) -> float:
return ((revenue - cost) / cost) * 100
Agents (@agent)
from strot_sdk import agent
@agent(
name='sales_analyst',
description='Analyzes sales data and provides insights',
tools=['calculate_roi', 'top_n'],
model='gpt-4o',
temperature=0.1,
)
class SalesAnalyst:
system_prompt = """You are a sales analyst.
Analyze data and provide actionable recommendations."""
Cortex Pipelines (@cortex)
Build data pipelines that compile to JSON DSL and deploy to your STROT instance.
from strot_sdk import cortex
from strot_sdk.cortex import Flow
@cortex(name='daily_etl', description='Daily ETL pipeline')
class DailyETL:
def build(self, flow: Flow):
# Load data from a saved query
data = flow.data_connector('load_sales', query_id=42)
# Transform with LLM
cleaned = flow.transform(data, prompt='Clean and normalize the data')
# Route based on content
router = flow.router(cleaned, routes=[
{'name': 'high_value', 'description': 'Orders over $1000'},
{'name': 'standard', 'description': 'Regular orders'},
], prompt='Classify by order value')
# Publish results
flow.publish(router, name='daily_report', destination='slack', channel='#data')
Available Flow methods:
| Method | Description |
|---|---|
flow.data_connector(id, query_id=...) |
Load data from a saved query |
flow.transform(step, prompt=...) |
LLM-powered data transformation |
flow.arena(step, tool=..., parameters=...) |
Run an Arena tool |
flow.router(step, routes=[], prompt=...) |
Conditional routing |
flow.gate(step, condition=..., approval_required=...) |
Quality gate or approval |
flow.publish(step, name=..., destination=...) |
Output/publish results |
flow.action(step, action_type=..., target=...) |
Notifications/triggers |
flow.ai_feeds(step, prompt=..., insight_count=...) |
Generate AI insights |
flow.connect(source, target) |
Manual edge connection |
Pages / Dashboards (@page)
Build dashboards that compile to JSON layout and deploy to your STROT instance.
from strot_sdk import page
from strot_sdk.pages import Dashboard, Row, KPI, Chart, Table
@page(name='sales_dashboard', description='Sales overview', type='dashboard')
class SalesDashboard:
def layout(self):
return Dashboard(
Row(
KPI(query_id=1, label='Revenue', format='currency'),
KPI(query_id=2, label='Orders'),
KPI(query_id=3, label='Customers'),
KPI(query_id=4, label='Avg Order', format='currency'),
),
Row(
Chart(query_id=5, type='line', title='Revenue Trend', span=8),
Chart(query_id=6, type='donut', title='By Region', span=4),
),
Row(
Table(query_id=7, title='Recent Orders', sortable=True),
),
)
Block types: KPI, Chart, Table, Text, StatGrid, ProgressList
Chart types: line, bar, area, donut, scatter, stacked_bar, funnel
Grid: 12-column layout. Set span on any block (default varies by type).
LLM
All LLM calls go through your STROT instance — no API keys needed in your code.
from strot_sdk import llm
# Simple completion
result = llm.complete("Summarize this: " + text)
result = llm("Shorthand syntax works too")
# Chat
result = llm.chat([
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is 2+2?"},
])
# Classify
category = llm.classify("Great product!", ["positive", "negative", "neutral"])
# Extract structured data
data = llm.extract("John is 30 years old", {"name": "string", "age": "number"})
# Transform data
result = llm.transform(data, "Convert to French", output_format="json")
Data Access
from strot_sdk import strot, query, query_one, query_df
# Via registry (saved queries by name)
rows = strot.queries['monthly_sales'].execute()
# Via data source
rows = strot.dataSources['production'].query("SELECT * FROM users LIMIT 10")
# Direct SQL
rows = query("SELECT * FROM users", data_source_id=1)
row = query_one("SELECT * FROM users WHERE id = 1", data_source_id=1)
# Pandas DataFrame (requires strot-sdk[pandas])
df = query_df("SELECT * FROM orders", data_source_id=1)
Destinations
from strot_sdk import email, slack, webhook
email.send(to="team@example.com", subject="Report Ready", body="The daily report is ready.")
slack.send(channel="#alerts", message="New alert!")
webhook.post(url="https://api.example.com/hook", data={"event": "deploy"})
CLI Reference
Authentication
strot login # Interactive (opens browser)
strot login --token sk_live_abc123 # Direct API key
strot login -i https://app.strot.ai -o <org-uuid>
strot whoami # Show current user/org
strot logout # Clear credentials
strot logout --all # Clear all profiles
Project Scaffolding
strot init tool my-calculator # Python tool
strot init agent my-analyst # Python agent
strot init cortex my-pipeline # Cortex pipeline
strot init page my-dashboard # Page/dashboard
strot init tool my-tool -d "Description" -c finance
Resources
strot resources # List all resources
strot resources queries # List saved queries
strot resources datasources # List data sources
strot resources tools # List deployed tools
Testing & Deployment
strot test # Run/compile locally
strot test -p input_text="Hello" # Run with parameters
strot deploy # Deploy to STROT instance
strot deploy --dry-run # Validate without deploying
Configuration
Credentials are stored in ~/.strot/credentials (YAML, 0600 permissions):
version: 1
current_profile: default
profiles:
default:
url: https://app.strot.ai
api_key: sk_live_abc123
org: 98bf9a0a-c9cd-42a8-9ea4-4f7fee9a4535
user_email: dev@example.com
Priority chain (highest to lowest):
- Constructor arguments (
StrotClient(url=..., api_key=...)) - Environment variables (
STROT_URL,STROT_API_KEY) - Credentials file (
~/.strot/credentials)
Multiple profiles:
strot login --profile staging -i https://staging.strot.ai
strot login --profile production -i https://app.strot.ai
Development
git clone https://github.com/strot-ai/strot-sdk.git
cd strot-sdk
poetry install --with dev,cli
# Run tests
poetry run pytest -v
# Run with coverage
poetry run pytest --cov=strot_sdk
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 strot_sdk-0.1.0.tar.gz.
File metadata
- Download URL: strot_sdk-0.1.0.tar.gz
- Upload date:
- Size: 35.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72e11f4e27b10c7db0d07a524b2faa469f3a83c5ea2e56ad0d816d8a16fb0951
|
|
| MD5 |
6bd7bfdb2ae1d0d2210dca910e048cb2
|
|
| BLAKE2b-256 |
8739650b11d69df08e8898bd04e21c06f115c814c4ed4c3a416044ef9fc0dc32
|
Provenance
The following attestation bundles were made for strot_sdk-0.1.0.tar.gz:
Publisher:
publish.yml on strot-ai/strot-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
strot_sdk-0.1.0.tar.gz -
Subject digest:
72e11f4e27b10c7db0d07a524b2faa469f3a83c5ea2e56ad0d816d8a16fb0951 - Sigstore transparency entry: 1059382055
- Sigstore integration time:
-
Permalink:
strot-ai/strot-sdk@dadc7e6b0ed98aba667158840e636bdadd8929cd -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/strot-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@dadc7e6b0ed98aba667158840e636bdadd8929cd -
Trigger Event:
release
-
Statement type:
File details
Details for the file strot_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: strot_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 44.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
438768dac48385f84b7f779da48a4fce3379225d7abe7266cdf136a72dd86a51
|
|
| MD5 |
9e0d85fe7630795c77268d81a7d95806
|
|
| BLAKE2b-256 |
4fa385e8b43f6dcf9fb5398982568e62c2a7804170bfd8b195f2d85f08dd2182
|
Provenance
The following attestation bundles were made for strot_sdk-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on strot-ai/strot-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
strot_sdk-0.1.0-py3-none-any.whl -
Subject digest:
438768dac48385f84b7f779da48a4fce3379225d7abe7266cdf136a72dd86a51 - Sigstore transparency entry: 1059382063
- Sigstore integration time:
-
Permalink:
strot-ai/strot-sdk@dadc7e6b0ed98aba667158840e636bdadd8929cd -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/strot-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@dadc7e6b0ed98aba667158840e636bdadd8929cd -
Trigger Event:
release
-
Statement type: