Skip to content

Remote Quick Commands (RQC)

Remote Quick Commands (RQC) are AI-powered commands that run on StackSpot AI's infrastructure. They can analyze, transform, and generate code based on your inputs.

RQC Phases

The RQC system works in two phases:

  1. Create Execution: Submit a request to the API, which returns an execution ID
  2. Poll for Result: Periodically check the execution status until it completes

The SDK handles all of this automatically, providing a simple synchronous interface.

from stkai import RemoteQuickCommand, RqcRequest

rqc = RemoteQuickCommand(slug_name="my-quick-command")
response = rqc.execute(RqcRequest(payload={"input": "data"}))

Key Concepts

RqcRequest

Represents a request to be executed:

from stkai import RqcRequest

request = RqcRequest(
    payload={"code": "def foo(): pass"},  # Data to send to the Quick Command
    id="my-unique-id",                     # Optional: auto-generated UUID if not provided
    metadata={"source": "main.py"},        # Optional: custom metadata for tracking
)

RqcResponse

Contains the execution result:

response = rqc.execute(request)

# Check status
if response.is_completed():
    result = response.result        # Processed result (dict or list)
    raw = response.raw_response     # Raw API response
elif response.is_failure():
    error = response.error          # Error message
elif response.is_timeout():
    # Execution took too long
    pass

Execution Status

Status Description
PENDING Request not yet submitted
CREATED Server acknowledged the request
RUNNING Execution is being processed
COMPLETED Finished successfully
FAILURE Server-side error
ERROR Client-side error (network, parsing)
TIMEOUT Any timeout, client or server-side (polling, HTTP request, HTTP 408/504)

Features

Feature Description
Automatic Retry Automatic retry with exponential backoff for transient failures
Batch Execution Process multiple requests concurrently with execute_many()
Result Handlers Customize how responses are processed with pluggable handlers
Event Listeners Monitor execution lifecycle with custom event handlers
Rate Limiting Control request rate to avoid API throttling

Quick Example

from stkai import RemoteQuickCommand, RqcRequest

# Create client
rqc = RemoteQuickCommand(slug_name="code-review")

# Execute single request
response = rqc.execute(
    request=RqcRequest(payload={"code": "print('hello')"})
)

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

Next Steps