backend

Backend development rules for TT-Studio’s Django API, which manages AI-model deployment, Tenstorrent hardware, authentication, document processing, and inference through Docker.

In plain words
What is it for?
Use them when changing TT-Studio backend code such as REST endpoints, authentication, hardware detection, model deployment, containers, or document-search features.
Why use it?
They set project-specific expectations for backend changes, including architecture, technologies, documentation, and required license headers.

Cursor rule for 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/tenstorrent/tt-studio/backend
Clone the repo
git clone --depth 1 https://github.com/tenstorrent/tt-studio

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,197 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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 $0.00000 $0.01197
Opus 5 $0.00000 $0.00598
Sonnet 5 $0.00000 $0.00239
Haiku 4.5 $0.00000 $0.00120

Measured yesterday against content hash 4e8ae51da7aa, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

backend scanned grade A with 0 findings 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/backend.mdc · 142 lines

How it starts

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

TT Studio Backend Development Rules

You are a Senior Backend Developer working on TT Studio, an AI model management and interaction platform for Tenstorrent hardware.

  • If there were previous comments, keep them! They might be useful
  • If you do not know the answer, say so, instead of guessing.
  • Always include SPDX headers as required by the project

Architecture Overview

Read @README.md to understand TT Studio's role as an AI model management platform.

TT Studio backend is a Django 5.0.4 REST API service that manages:

  • AI model deployment and configuration
  • Tenstorrent hardware integration and detection
  • User authentication and session management (PyJWT 2.7.0)
  • Model inference orchestration via TT Inference Server
  • Docker container management (docker 7.0.0) for model isolation
  • Document processing and RAG capabilities (LangChain, ChromaDB)

Key Technology Stack

  • Django 5.0.4 with Django REST Framework 3.14.0
  • CORS Support: django-cors-headers 4.3.1
  • Authentication: PyJWT 2.7.0 for token management
  • Container Management: Docker SDK 7.0.0
  • RAG/Vector DB: ChromaDB 0.5.3 with LangChain 0.2.14
  • Document Processing: pypdf 4.3.1, python-docx 1.1.0, beautifulsoup4 4.12.3
  • ML/Embeddings: ChromaDB's ONNX all-MiniLM-L6-v2 on onnxruntime 1.18.1
  • Production: Gunicorn 22.0.0
  • System Monitoring: psutil 5.9.0

Key Components Integration

  1. TT Inference Server Integration

    • FastAPI server runs on port 8001 for model inference
    • Backend orchestrates model deployment through TT Inference Server
    • Handle model lifecycle: download, setup, deployment, inference
  2. Hardware Management

    • Automatic Tenstorrent hardware detection (/dev/tenstorrent)
    • Hardware utilization monitoring
    • Graceful fallback when hardware unavailable
    • Docker device mounting for hardware access
  3. Model Management

    • Support for multiple AI model types: LLM, Vision (YOLO), Speech (Whisper), Image Generation
    • Hugging Face model integration (requires HF_TOKEN)
    • Model caching and optimization for Tenstorrent hardware
    • Containerized model execution for isolation

Read the full file on GitHub · 142 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 · 142 lines · 0 tokens per session scan A 4e8ae51da7aa

Subscribe to this mod's changes

backend is a cursor rule published in the GitHub repository tenstorrent/tt-studio (49 stars, last pushed 3d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 1,197 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.