Skip to main content

Python SDK for StackSpot AI - Remote Quick Commands and more

Project description

stkai

PyPI Python License

An unofficial, opinionated Python SDK for StackSpot AI — Execute Remote Quick Commands (RQCs) and interact with AI Agents with built-in resilience.

Note: This is a community-driven SDK, not officially maintained by StackSpot. It was built to fill gaps we encountered in real-world projects — such as retries, rate limiting, and batch execution — that the platform's API alone doesn't provide out of the box.

Design Principles

This SDK is opinionated by design. It prioritizes:

  • Reliability over latency — Built-in retries, rate limiting, and fault tolerance mechanisms
  • Predictability over throughput — Synchronous, blocking API for straightforward debugging and reasoning
  • Pragmatism over flexibility — Simple, direct API with well-designed extension points
  • Convention over configuration — Sensible defaults and seamless StackSpot CLI integration

Installation

Install from PyPI:

pip install stkai

Requirements

  • Python 3.12+
  • StackSpot CLI installed and authenticated, or client credentials for standalone auth

Quick Start

Remote Quick Commands

Execute LLM-powered quick commands with automatic polling and retries:

from stkai import RemoteQuickCommand, RqcRequest

rqc = RemoteQuickCommand(slug_name="my-quick-command")
response = rqc.execute(
    request=RqcRequest(payload={"code": "def hello(): pass"})
)

if response.is_completed():
    print(response.result)
else:
    print(response.error_with_details())

AI Agents

Chat with StackSpot AI Agents for conversational AI capabilities:

from stkai import Agent, ChatRequest

agent = Agent(agent_id="my-agent-slug")
response = agent.chat(
    request=ChatRequest(user_prompt="What is SOLID?")
)

if response.is_success():
    print(response.result)
else:
    print(response.error_with_details())

Batch Processing

Process multiple requests concurrently with thread pool execution:

# RQC batch
responses = rqc.execute_many(
    request_list=[RqcRequest(payload=data) for data in files]
)

completed = [r for r in responses if r.is_completed()]
# Agent batch
responses = agent.chat_many(
    request_list=[ChatRequest(user_prompt=p) for p in prompts]
)

successful = [r for r in responses if r.is_success()]

Features

Feature Description Docs
Remote Quick Commands Execute AI commands with polling and retries Guide
AI Agents Chat with agents, batch execution, conversations, knowledge sources Guide
Batch Execution Process multiple requests concurrently (RQC and Agents) RQC · Agents
Result Handlers Customize response processing Guide
Event Listeners Monitor execution lifecycle Guide
Rate Limiting Token Bucket and adaptive AIMD algorithms Guide
Configuration Global config via code or environment variables Guide

Documentation

Full documentation available at: https://rafaelpontezup.github.io/stkai-sdk-python/

Development

# Clone and setup
git clone https://github.com/rafaelpontezup/stkai-sdk.git
cd stkai-sdk
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"

# Run tests
pytest

# Run tests with coverage
pytest --cov=src --cov-report=term-missing

# Lint and type check
ruff check src tests
mypy src

# Build docs locally
pip install -e ".[docs]"
mkdocs serve

License

Apache License 2.0 - 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

stkai-0.4.18.tar.gz (112.9 kB view details)

Uploaded Source

Built Distribution

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

stkai-0.4.18-py3-none-any.whl (91.7 kB view details)

Uploaded Python 3

File details

Details for the file stkai-0.4.18.tar.gz.

File metadata

  • Download URL: stkai-0.4.18.tar.gz
  • Upload date:
  • Size: 112.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for stkai-0.4.18.tar.gz
Algorithm Hash digest
SHA256 f2194c1d5de23ed1ed5c57fb3b8f74a9347cfc00a1a9059f6757936341084c1f
MD5 f86914c487be61affc34d43f4cd9c086
BLAKE2b-256 ef67a02c70fc3582e1882319a871e48654e7b09522a942bcabd75f48114582d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for stkai-0.4.18.tar.gz:

Publisher: publish.yml on rafaelpontezup/stkai-sdk-python

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

File details

Details for the file stkai-0.4.18-py3-none-any.whl.

File metadata

  • Download URL: stkai-0.4.18-py3-none-any.whl
  • Upload date:
  • Size: 91.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for stkai-0.4.18-py3-none-any.whl
Algorithm Hash digest
SHA256 fca9b4083ad7d2e514dfb2c51272f07458671718eccd4b51b18d6121b729949b
MD5 86528e1e325aee80927498cf62fa0fe7
BLAKE2b-256 c481a325089e31ec534bfc4bf5a82874206d54f123bc9a006864e1b0a68575a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for stkai-0.4.18-py3-none-any.whl:

Publisher: publish.yml on rafaelpontezup/stkai-sdk-python

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