python-sdk

python-sdk is a cursor rule for Cursor from sunra-ai/sunra-clients. It costs 46 tokens per session (5,373 once invoked), scanned C, original, Apache-2.0.

A role guide for developers building a Python software library, including rules for project structure, naming, formatting, type hints, and synchronous and asynchronous clients.

In plain words
What is it for?
It helps maintain a Python SDK, a library that lets programs connect to a service, while following the project's coding standards.
Why use it?
It gives coding agents consistent project rules instead of leaving style and implementation choices unclear.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/sunra-ai/sunra-clients/python-sdk
Clone the repo
git clone --depth 1 https://github.com/sunra-ai/sunra-clients

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for python-sdk

README.md
[![agentmods](https://agentmods.dev/badge/rules/sunra-ai/sunra-clients/python-sdk.svg)](https://agentmods.dev/rules/sunra-ai/sunra-clients/python-sdk)
Your own site
<a href="https://agentmods.dev/rules/sunra-ai/sunra-clients/python-sdk"><img src="https://agentmods.dev/badge/rules/sunra-ai/sunra-clients/python-sdk.svg" alt="Measured on agentmods" height="20"></a>
Per session 46 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 5,373 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00046 $0.05373
Opus 5 $0.00023 $0.02686
Sonnet 5 $0.00009 $0.01075
Haiku 4.5 $0.00005 $0.00537

Measured yesterday against content hash 69bbb2a7c944, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade C, and why

python-sdk scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

rm -rf build/ dist/ *.egg-info/
.cursor/rules/roles/python-sdk.mdc · 772 lines

How it starts

The opening of the file, as written. The whole thing — 772 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Sunra Clients - Python SDK Developer Role Document

Overview

This document defines the role and responsibilities of a Python SDK Developer for the Sunra Clients project. The Python SDK provides both synchronous and asynchronous client libraries for interacting with Sunra.ai services, following Python best practices and type safety standards.

Project Structure

The Python SDK is organized as follows:

  • src/sunra_client/: Main package directory
    • init.py: Package initialization and public API
    • client.py: Main client implementation with sync/async support
    • auth.py: Authentication and credential management
    • py.typed: Type checking marker file

Development Guidelines

1. Code Style and Standards

Python Style Guide
  • Follow PEP 8 coding standards
  • Use 4 spaces for indentation (Python standard)
  • Maximum line length: 120 characters
  • Use snake_case for functions and variables: submit_request, get_status
  • Use PascalCase for class names: SunraClient, QueueClient
  • Use UPPER_SNAKE_CASE for constants: DEFAULT_TIMEOUT, MAX_RETRIES
Type Hints
  • Use type hints for all function parameters and return values
  • Use modern union syntax: str | None instead of Optional[str]
  • Include from __future__ import annotations for forward references
  • Maintain py.typed file for type checking support
Import Organization
# Standard library imports
import asyncio
import os
from typing import Any, Dict, Optional, Union

# Third-party imports
import httpx
from pydantic import BaseModel, Field

# Local imports
from .auth import CredentialsResolver
from .exceptions import SunraException, SunraValidationException

2. Architecture Patterns

Client Architecture
class SunraClient:
    """Main Sunra client with both sync and async support."""

    def __init__(
        self,
        credentials: str | None = None,
        api_endpoint: str | None = None,
        queue_domain: str | None = None,
        timeout: float = 300.0,
    ):
        self._credentials = credentials or os.getenv("SUNRA_KEY")
        self._api_endpoint = api_endpoint or os.getenv("SUNRA_API_ENDPOINT")
        self._queue_domain = queue_domain or os.getenv("SUNRA_QUEUE_DOMAIN")
        self._timeout = timeout

        # Initialize HTTP clients
        self._sync_client = httpx.Client(timeout=timeout)
        self._async_client = httpx.AsyncClient(timeout=timeout)

    def subscribe(self, endpoint_id: str, **kwargs) -> Dict[str, Any]:
        """Synchronous subscribe method."""
        pass

    async def subscribe_async(self, endpoint_id: str, **kwargs) -> Dict[str, Any]:
        """Asynchronous subscribe method."""
        pass

Read the full file on GitHub · 772 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 772 lines · 46 tokens per session scan C 69bbb2a7c944

Subscribe to this mod's changes

python-sdk is a cursor rule published in the GitHub repository sunra-ai/sunra-clients (7 stars, last pushed 7d ago), licensed Apache-2.0. It adds 46 tokens to every session and 5,373 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-04.