# Deploying LLM-Powered Services

> Package your AI backend as a container, manage secrets and configuration, and handle long-running requests with queues and background jobs. Free notes, key...

Canonical: https://www.internhack.in/roadmaps/tracks/ai-engineer/deploying-ai-services
Last updated: 2026-11-28

Package your AI backend as a container, manage secrets and configuration, and handle long-running requests with queues and background jobs.

Intermediate · about 6 hours · difficulty 3/5

Learn first: [Streaming Responses](https://www.internhack.in/roadmaps/tracks/ai-engineer/streaming-responses), [Async I/O and Concurrency](https://www.internhack.in/roadmaps/tracks/ai-engineer/async-programming)

An AI feature is still a web service, with a few twists: requests are slow, outputs stream, costs scale with usage, and some jobs (ingesting documents, running agents, batch evals) take minutes.

### Service basics

- **Containerize** your API with Docker so the same image runs locally, in CI and in production.
- **Configuration**: model names, temperatures and prompt versions come from config, not hard-coded strings, so you can change them without a redeploy.
- **Secrets**: provider API keys live in a secret manager or platform environment variables, never in the image.
- **Timeouts**: set them at every layer (client, load balancer, your code, the model SDK). Many platforms kill requests after 30 to 60 seconds, which long agent runs exceed.

### Long-running work

- Move ingestion, embedding and agent tasks to a **job queue** (Celery, RQ, BullMQ, cloud task queues) with workers.
- Return a job id immediately and let the client poll or subscribe for progress.
- Make jobs **idempotent and resumable** so a crash halfway does not duplicate side effects.
- For durable multi-step agent workflows, workflow engines such as Temporal or Inngest provide retries and state.

### Streaming in production

Check that proxies and load balancers do not buffer server-sent events, and send heartbeats on long streams.

### Where to deploy

Serverless platforms are simple for light traffic; containers on a PaaS or Kubernetes suit steady load and background workers. GPU hosting is only needed if you serve models yourself.

### Good enough to move on

You can deploy a containerized AI API with streaming, config-driven model settings, secrets from the platform, and a worker that processes document ingestion jobs from a queue.

## Key concepts

- **Docker for AI services**
- **Config-driven model settings**
- **Secret management**
- **Timeouts at every layer**
- **Job queues and workers**
- **Durable workflow engines**
- **Streaming through proxies**
- **Serverless vs containers**

## Mini project

Deploy a Dockerized FastAPI or Node service to a cloud platform with a streaming chat endpoint and a separate worker that ingests uploaded PDFs from a queue, reporting progress to the client.

## Check yourself

Why should a 3 minute agent run not be handled inside a normal synchronous HTTP request?

## Free resources

- [Docker get started](https://docs.docker.com/get-started/) (Docker)
- [FastAPI: deployment](https://fastapi.tiangolo.com/deployment/) (FastAPI)
- [Celery documentation](https://docs.celeryq.dev/en/stable/) (Celery)

Previous: [Image and Media Generation](https://www.internhack.in/roadmaps/tracks/ai-engineer/image-generation) · Next: [Latency Optimization](https://www.internhack.in/roadmaps/tracks/ai-engineer/latency-optimization)

## More in LLMOps and Production Engineering

- [Deploying LLM-Powered Services](https://www.internhack.in/roadmaps/tracks/ai-engineer/deploying-ai-services)
- [Latency Optimization](https://www.internhack.in/roadmaps/tracks/ai-engineer/latency-optimization)
- [Response Caching and Semantic Caching](https://www.internhack.in/roadmaps/tracks/ai-engineer/llm-caching)
- [Model Routing, Gateways and Fallbacks](https://www.internhack.in/roadmaps/tracks/ai-engineer/model-routing-fallbacks)
- [Serving Open-Weight Models at Scale](https://www.internhack.in/roadmaps/tracks/ai-engineer/serving-open-models)
- [GPU and Hardware Basics for AI Engineers](https://www.internhack.in/roadmaps/tracks/ai-engineer/gpu-basics)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [AI Engineer Roadmap](https://www.internhack.in/roadmaps/tracks/ai-engineer)
