Skip to content
Back to skills

Inference Serving

ASecurity

Provides a FastAPI inference endpoint pattern and a latency checklist for model serving; use when deploying a model to an API endpoint or optimizing inference latency.

  • 19 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 19, 2026
ai-agentspythonfastapiapi

Works with

  • api

Security analysis

A100/100

Scanned October 19, 2026

npx -y skills add sawrus/agent-guides --skill inference-serving --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Inference Serving?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Inference Serving
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/sawrus-inference-serving/badge)](https://www.skillsdirectory.com/skills/sawrus-inference-serving)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: inference-serving
description: "Provides a FastAPI inference endpoint pattern and a latency checklist for model serving; use when deploying a model to an API endpoint or optimizing inference latency."
---

# Skill: Inference Serving

## When to load

When deploying a model to an API endpoint or optimizing inference latency.

## FastAPI Inference Endpoint

```python
@app.on_event("startup")
def load_model():
    app.state.model = mlflow.pyfunc.load_model("models:/churn-predictor/Production")
    app.state.preprocessor = load_preprocessor()

@app.post("/predict", response_model=PredictionResponse)
def predict(request: PredictionRequest):
    try:
        features = app.state.preprocessor.transform([request.features])
        probability = app.state.model.predict(features)[0]
        log_prediction(request.user_id, request.features, float(probability))
        return PredictionResponse(
            user_id=request.user_id,
            churn_probability=float(probability),
        )
    except Exception as e:
        logger.error("Inference failed", error=str(e))
        return PredictionResponse(user_id=request.user_id, churn_probability=FALLBACK_PROBABILITY)
```

## Latency Checklist

- [ ] Model loaded at startup, not per request
- [ ] Input preprocessing vectorized (batch)
- [ ] ONNX conversion for framework-agnostic optimization
- [ ] Batch inference enabled for high-throughput

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.