Agent skill

AI Server

by Opentrons in Opentrons/opentrons

Conventions for the opentrons-ai-server FastAPI service — project structure, uv dependency management, settings, testing, Docker, and deployment.

Apache-2.0Auto-check: notesDevOps & Cloud

Install AI Server

skills CLI
$ npx skills add Opentrons/opentrons --skill ai-server -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Opentrons/opentrons ai-server --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Opentrons/opentrons.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.cursor/skills/ai-server .claude/skills/ai-server && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
ai-server
GitHub stars
521
Token cost
~2.5k tokens
SKILL.md length
816 words
Files
1
Skills in repo
17
Repo updated
First seen
Licence
Apache-2.0

At a glance

Conventions for the opentrons-ai-server FastAPI service — project structure, uv dependency management, settings, testing, Docker, and deployment.

  • Works in 4 steps: Add the field to the Settings class in… → Add the value to your local .env file → Before deploying: add the value in AWS… → …
  • Working with files in opentrons-ai-server/
  • SKILL.md covers Overview, API Endpoints, Package Manager — uv and Project Structure, plus 9 more sections
  • Calls make, uv and pytest

What it does

AI Server is an agent skill from Opentrons/opentrons. Conventions for the opentrons-ai-server FastAPI service — project structure, uv dependency management, settings, testing, Docker, and deployment. Use when working with files in opentrons-ai-server/ or discussing the AI server API.

Its SKILL.md is about 2.5k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in DevOps & Cloud, covering Dependency management, Backend development and Containers. It works with Docker and FastAPI. The repository describes itself as: Software for writing protocols and running them on the Opentrons Flex and Opentrons OT-2. The licence is Apache-2.0.

When your agent uses it

  • Working with files in opentrons-ai-server/
  • Discussing the AI server API

Example prompts

  • “Use the ai-server skill to convention for the opentrons-ai-server FastAPI service — project structure, uv dependency management, settings, testing…”
  • “/ai-server”

Requirements

  • Python 3
  • Docker

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Add the field to the Settings class in api/settings.py (use SecretStr for secrets)
  2. Add the value to your local .env file
  3. Before deploying: add the value in AWS Secrets Manager under the environment's secret name
  4. Re-deploy — the deploy script maps Settings fields to ECS container env vars automatically

What it can do on your machine

Read from SKILL.md and the folder at commit a14fef9. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • make
    • uv
    • pytest
    • uvicorn

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use uv, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

AI Server loads about 2.5k tokens when it runs. Until then it costs about 60 tokens; SKILL.md has 816 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~60
When it runs · the whole SKILL.md, loaded when a task matches
~2.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NoteMentions a .env fileSKILL.md:81
    - **Locally**: values come from a `.env` file (gitignored)
  • NoteMentions a .env fileSKILL.md:85
    ttings()` directly) to avoid re-parsing `.env` on every import
  • NoteMentions a .env fileSKILL.md:93
    Generate a template `.env` from defaults: `make gen-env`
  • NoteMentions a .env fileSKILL.md:128
    | Run the Docker container (requires `.env` file)               |
  • NoteMentions a .env fileSKILL.md:188
    2. Add the value to your local `.env` file

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from Opentrons/opentrons at commit a14fef9, republished under its Apache-2.0 licence (© Opentrons). 816 words, ~2,499 tokens.

Download SKILL.mdSave it as .claude/skills/ai-server/SKILL.md (or your agent's skills folder).
name
ai-server
description
Conventions for the opentrons-ai-server FastAPI service — project structure, uv dependency management, settings, testing, Docker, and deployment. Use when working with files in opentrons-ai-server/ or discussing the AI server API.

AI Server Instructions

Overview

opentrons-ai-server is a standalone FastAPI service for Opentrons AI — protocol generation, chat completions, and related AI features. It is not part of the monorepo build system; it has its own dependency management, CI workflows, and deployment pipeline.

Deployed environments: staging (staging.opentrons.ai) and prod (ai.opentrons.com), running on AWS ECS Fargate behind CloudFront.

API Endpoints

The server exposes four chat endpoints that return JSON responses:

EndpointPurpose
POST /api/chat/completionGeneral chat (no file attachments)
POST /api/chat/completion-multipartChat with file attachments (multipart form)
POST /api/chat/create-protocolGenerate a new protocol
POST /api/chat/update-protocolUpdate an existing protocol

All endpoints require a Bearer token in Authorization. Setting "fake": true in the request body bypasses the LLM and returns a canned response from api/domain/fake_responses.py — useful for local development without Anthropic API calls.

Package Manager — uv

This project uses uv for Python dependency management (not pipenv, pip-tools, or poetry).

FileRoleCommitted?
pyproject.tomlSingle source of truth for dependencies AND all tool configYes
uv.lockLocked dependency graphYes
requirements.txtUnused. Docker installs from uv.lock directlyNo (gitignored)
.venv/Local virtual environment created by uv syncNo (gitignored)
Key Commands
bash
make setup                    # Install all deps (uv sync --frozen)
uv add <package>              # Add production dep
uv add --dev <package>        # Add dev-only dep
uv remove <package>           # Remove dep
uv lock                       # Re-resolve after manual pyproject.toml edits
uv run <command>              # Run inside the managed venv

After changing deps, commit both pyproject.toml and uv.lock.

Project Structure

markdown
opentrons-ai-server/
├── api/ # Application source code
│ ├── handler/ # FastAPI app, routes, middleware (fast.py entrypoint)
│ ├── domain/ # Business logic — LLM prediction (Anthropic, OpenAI)
│ ├── models/ # Pydantic request/response models
│ ├── services/ # File processing and other services
│ ├── integration/ # External integrations (Auth0, Google Sheets, AWS)
│ ├── constants/ # Shared constants
│ ├── data/ # Static data files
│ ├── storage/ # Stored API docs, indexes
│ ├── utils/ # API docs sync, curation, metadata helpers
│ └── settings.py # Pydantic Settings — all env vars and secrets
├── tests/
│ ├── conftest.py # Pytest fixtures and --env option
│ ├── helpers/ # Client, token helpers for live testing
│ └── test\_\*.py # Unit and live tests
├── deploy.py # ECS Fargate deployment script
├── Dockerfile
├── Makefile
├── pyproject.toml
└── uv.lock

Configuration & Settings

All runtime configuration lives in api/settings.py via pydantic-settings:

  • Locally: values come from a .env file (gitignored)
  • Deployed: values come from AWS Secrets Manager, loaded into ECS by deploy.py
  • Every new env var or secret must be added as a field on the Settings class
  • Secrets use SecretStr type; non-secret vars are plain strings with defaults
  • Always import settings via the get_settings() singleton (not Settings() directly) to avoid re-parsing .env on every import

Notable settings:

  • allowed_origins — comma-separated CORS origins (must be explicit; wildcard * is invalid with allow_credentials=True)
  • request_timeout_seconds — request timeout in seconds (default "300"); production proxies must be configured to allow at least this duration
  • anthropic_max_tokens — stored as a string, cast to int when used

Generate a template .env from defaults: make gen-env

Tool Configuration

All config is in pyproject.toml — no separate config files:

ToolSectionPurpose
ruff[tool.ruff], [tool.ruff.lint], [tool.ruff.format]Linting AND formatting
mypy[tool.mypy], [[tool.mypy.overrides]]Strict type checking with pydantic plugin
pytest[tool.pytest.ini_options]Test runner config, markers: unit, live

Line length: 140. Target: Python 3.12. Mypy is in strict mode.

Makefile Targets

All targets run from opentrons-ai-server/.

Development
TargetDescription
make setupInstall all deps (uv sync --frozen --extra dev)
make teardownDelete .venv/
make formatAuto-fix lint + format with ruff, then prettier for .md/.json
make lintCheck lint (ruff) + type check (mypy) — no auto-fix
make prepformat then lint then unit-test
make unit-testRun unit tests (pytest tests -m unit)
Running Locally
TargetDescription
make local-runRun FastAPI with uvicorn (hot reload, no Docker)
make buildSync API docs, then build the Docker image
make runRun the Docker container (requires .env file)
make rebuildclean + build + run
make live-testRun live tests against a running server (ENV=local default)
make live-clientInteractive client for testing the API
Show full SKILL.md (329 more words)Show less
Deployment
TargetDescription
make deploy ENV=stagingBuild, push to ECR, update ECS service
make dry-deploy ENV=stagingRetrieve AWS data but make no changes
make build-only ENV=stagingBuild Docker image only, no push/deploy

Docker Build

The image is a two-stage build. The dependency stage copies a digest-pinned uv 0.11.17 binary and runs uv sync --frozen --no-dev --no-install-project, so packages come from uv.lock with their recorded hashes. The runtime stage copies only that virtualenv and api/; it does not contain uv.

make build syncs the Python API docs, then builds. The Docker build context is the repo root (not opentrons-ai-server/). Docs come from the pinned DOCS_TAG Makefile variable and must be present under api/storage/api_docs/docs/v2.

Entrypoint: uvicorn api.handler.fast:app (3 workers, port 8000).

Python API docs curation

The helper model that selects relevant docs reads api/storage/api_docs/api_docs_struct.md. Rich <about> routing text is not taken from synced markdown alone; it comes from committed curation.

FileEdit?Purpose
api_docs_struct_about.mdYesSource of truth for curated <about> text
api_docs_struct.mdNoGenerated on make sync-api-docs
docs/v2/ (synced markdown)NoGitignored; fetched from DOCS_TAG
bash
make sync-api-docs              # regenerate api_docs_struct.md from curated about file
make check-api-docs-curation    # fail if curated entries and synced docs diverge

Full details: opentrons-ai-server/docs/API_DOCS_CURATION.md

Testing

  • Unit tests (@pytest.mark.unit): run offline → make unit-test
  • Live tests (@pytest.mark.live): run against a real server → make live-test ENV=local
  • The --env pytest option selects the target environment (local/staging/prod)
  • Test helpers in tests/helpers/ handle Auth0 token caching and HTTP client setup

Authentication

Auth0 JWT verification via api/integration/auth.py. Config: auth0_domain, auth0_api_audience, auth0_issuer, auth0_algorithms in Settings.

Code Conventions

  • Formatting and linting: ruff only (no black). make format to auto-fix
  • Type annotations: required everywhere — mypy strict mode
  • Pydantic models for all request/response schemas (in api/models/)
  • Structured logging via structlog
  • Import sorting handled by ruff's I rule (isort-compatible)

Adding a New Env Var or Secret

  1. Add the field to the Settings class in api/settings.py (use SecretStr for secrets)
  2. Add the value to your local .env file
  3. Before deploying: add the value in AWS Secrets Manager under the environment's secret name
  4. Re-deploy — the deploy script maps Settings fields to ECS container env vars automatically

© Opentrons, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .cursor/skills/ai-server of Opentrons/opentrons.

Open the folder on GitHubat commit a14fef9

Compare with similar skills

AI Server next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

AI Server compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
AI Server this skillOpentrons/opentrons521—~2.5kAutomated safety check: NotesApache-2.0
Model Deploymentsecondsky/claude-skills227—~2.4kAutomated safety check: PassMIT
Flowfile Debugging PlaybookEdwardvaneechoud/Flowfile373—~6.3kAutomated safety check: PassMIT
Releasebmeares/Meerschaum154—~1.1kAutomated safety check: NotesApache-2.0
Monstermq Broker Configvogler75/monster-mq143—~2.2kAutomated safety check: PassGPL-3.0
Releasear-io/ar-io-node127—~4.2kAutomated safety check: NotesAGPL-3.0

Similar skills

  • Model Deployment

    secondsky/claude-skills

    Deploy ML models with FastAPI, Docker, Kubernetes. An agent skill from secondsky/claude-skills.

    227 GitHub stars~2.4k tokensUpdated 10 days ago
    DevOps & CloudAuto-check passed
  • Flowfile Debugging Playbook

    Edwardvaneechoud/Flowfile

    Symptom-to-cause triage playbook for Flowfile (core/worker/kernel/frontend/AI) — covers "no such table" DB cascades (two distinct causes), import-time Alembic migration corruption, silent…

    373 GitHub stars~6.3k tokensUpdated today
    DevelopmentAuto-check passed
  • Release

    bmeares/Meerschaum

    Meerschaum release process — bump version, update changelog, stage dev→main PR, run CI, publish to PyPI, tag, GitHub release, build/push Docker images, rebuild docs on prod VPS.

    154 GitHub stars~1.1k tokensUpdated 1 mo ago
    DevOps & CloudAuto-check: notes
  • Monstermq Broker Config

    vogler75/monster-mq

    Guide for configuring, deploying, and operating the MonsterMQ broker.

    143 GitHub stars~2.2k tokensUpdated 2 days ago
    DevOps & CloudAuto-check passed
  • Release

    ar-io/ar-io-node

    Drive the AR.IO Node release process end-to-end — preflight checks, prepare commit, finalize with image SHAs, test docker compose profiles, tag & publish, and post-release cleanup.

    127 GitHub stars~4.2k tokensUpdated today
    DevOps & CloudAuto-check: notes
  • Deploy

    clacky-ai/openclacky

    Deploy Rails applications to Railway. An agent skill from clacky-ai/openclacky.

    1.2k GitHub stars~1.9k tokensUpdated today
    DevOps & CloudAuto-check passed

More from Opentrons/opentrons

All 17 skills in this repo
  • AI Client

    Opentrons/opentrons

    Conventions for the opentrons-ai-client React/TypeScript frontend — project structure, API integration, state management (Jotai), feature flags, types, and testing.

    521 GitHub stars~1.6k tokensUpdated today
    Auto-check passed
  • Analyses Snapshot Testing

    Opentrons/opentrons

    Conventions for the analyses snapshot testing framework in analyses-snapshot-testing/.

    521 GitHub stars~1.7k tokensUpdated today
    Auto-check passed
  • CSS Modules

    Opentrons/opentrons

    CSS Modules conventions, Stylelint rules, design tokens (spacing, colors, typography, border-radius), and patterns for the Opentrons monorepo.

    521 GitHub stars~2.2k tokensUpdated today
    Auto-check passed
  • Docs

    Opentrons/opentrons

    Authoring and styling guidelines for the Opentrons /docs MkDocs project.

    521 GitHub stars~2.8k tokensUpdated today
    Auto-check passed
  • E2E Testing

    Opentrons/opentrons

    E2E testing conventions for Protocol Designer and Labware Library using Playwright + pytest in e2e-testing/.

    521 GitHub stars~3k tokensUpdated today
    Auto-check: notes
  • JS Package Testing

    Opentrons/opentrons

    Vite demo and Playwright + Applitools tests for packed @opentrons JS packages in js-package-testing/.

    521 GitHub stars~1.2k tokensUpdated today
    Auto-check: notes

Works with

Questions about AI Server

What does AI Server do?

Conventions for the opentrons-ai-server FastAPI service — project structure, uv dependency management, settings, testing, Docker, and deployment. AI Server is an agent skill from Opentrons/opentrons. Conventions for the opentrons-ai-server FastAPI service — project structure, uv dependency management, settings, testing, Docker, and deployment.

When should I use AI Server?

AI Server fits situations like: working with files in opentrons-ai-server/; discussing the AI server API.

How do I install AI Server in Claude Code?

Run `npx skills add Opentrons/opentrons --skill ai-server -a claude-code`. Or copy the skill folder (.cursor/skills/ai-server in Opentrons/opentrons) into .claude/skills/ai-server in your project. Claude Code loads it when a task matches its description.

How do I install AI Server in Codex?

Run `npx skills add Opentrons/opentrons --skill ai-server -a codex`. Or copy the skill folder (.cursor/skills/ai-server in Opentrons/opentrons) into .agents/skills/ai-server in your project. Codex loads it when a task matches its description.

Can I use AI Server in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Opentrons/opentrons --skill ai-server -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/ai-server, .gemini/skills/ai-server, .github/skills/ai-server and .opencode/skills/ai-server in your project.

What does AI Server need to run?

Going by SKILL.md and its folder, AI Server needs the command-line tools its instructions call (make, uv, pytest and uvicorn). Our summary lists: Python 3; Docker.

Does AI Server access the network?

SKILL.md contains no URLs. Its commands use uv, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is AI Server safe to install?

Our automated static check of SKILL.md found notes only (mentions a .env file), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does AI Server use?

AI Server is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does AI Server use?

About 2.5k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to AI Server?

Skills that share tags, products or a category with AI Server: Model Deployment (secondsky/claude-skills, 227 stars), Flowfile Debugging Playbook (Edwardvaneechoud/Flowfile, 373 stars), Release (bmeares/Meerschaum, 154 stars) and Monstermq Broker Config (vogler75/monster-mq, 143 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains AI Server?

Opentrons (a GitHub organization) maintains it in Opentrons/opentrons, which has 521 GitHub stars. The repository holds 17 skills in this directory. The repository was last updated on October 7, 2026.

Source: Opentrons/opentrons on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.