# Upstash Knowledge Base

> **Source:** https://upstash.com/kb
> **Format:** text/markdown, machine-readable index for agents and LLMs

---

Guides, comparisons and how-tos from the Upstash team. Every article is also available as markdown at its URL plus `.md`.

This site has a search endpoint: https://context7.com/api/v2/ask?siteKey=ask_4cf2adc7846aa874f833b068&query=<URL-encoded question>. It returns documentation that answers the question, with a source link for each part. No API key is needed. If nothing matches, it says so.

## Articles

### [How to Run Untrusted Python Code Safely (Without exec())](https://upstash.com/kb/how-to-run-untrusted-python-code-safely-without-exec)

**Date:** 2026-11-12  
**Topic:** Box

What happens when a user types Python into your app? Or your agent spits out a pandas script to answer some question? Now you have code on your server you didn’t write, and you’re supposed to run it. It can read your environment variables. It can talk to some URL. It can run until the heat death of the universe. It can do whatever the process running it is allowed to do.

### [How to Add Memory to a Vercel Eve Agent with Redis](https://upstash.com/kb/vercel-eve-memory-redis)

**Date:** 2026-11-12  
**Topic:** Redis

Add chat history and long-term user memory to a Vercel Eve agent with Upstash Redis and the AgentKit Eve adapter.

### [How to Add Memory to a TanStack AI Agent with Redis](https://upstash.com/kb/tanstack-ai-memory-redis)

**Date:** 2026-11-11  
**Topic:** Redis

Add chat history and long-term user memory to a TanStack AI agent with Upstash Redis and the AgentKit TanStack AI adapter.

### [How to Add Memory to a Vercel AI SDK Agent with Redis](https://upstash.com/kb/vercel-ai-sdk-memory-redis)

**Date:** 2026-11-11  
**Topic:** Redis

Add chat history and long-term user memory to a Vercel AI SDK agent with Upstash Redis and AgentKit.

### [Upstash Blob vs UploadThing: Which Is Better for File Uploads in React and Next.js?](https://upstash.com/kb/upstash-blob-vs-uploadthing)

**Date:** 2026-11-10  
**Topic:** Blob

Upstash Blob vs UploadThing for React and Next.js file uploads: pricing, code, maintenance, and a November 2026 upload benchmark.

### [AWS S3 vs Cloudflare R2 vs Upstash Blob for Next.js (2026)](https://upstash.com/kb/s3-vs-r2-for-nextjs)

**Date:** 2026-11-10  
**Topic:** Blob

AWS S3 vs Cloudflare R2 for a Next.js app, compared on pricing, egress fees, S3 compatibility, presigned uploads and Vercel's 4.5 MB limit, and why Upstash Blob is the better pick for most Next.js apps.

### [Best Algolia Alternatives in 2026](https://upstash.com/kb/best-algolia-alternatives)

**Date:** 2026-11-09  
**Topic:** Redis Search

The best Algolia alternatives in 2026, compared on pricing, typo tolerance, search-as-you-type and hosting: Upstash Redis Search, Typesense, Meilisearch, Elasticsearch, OpenSearch, Orama and Postgres.

### [Best S3 Alternatives in 2026](https://upstash.com/kb/best-s3-alternatives)

**Date:** 2026-11-06  
**Topic:** Blob

The best S3 alternatives in 2026, compared on pricing, egress, S3 compatibility and browser uploads, with a pick for each use case.

### [Where Should You Store User-Uploaded Files in a Web App?](https://upstash.com/kb/where-should-you-store-user-uploaded-files-in-a-web-app)

**Date:** 2026-11-03  
**Topic:** Blob

"Store uploads in object storage and keep only the key in your database. The upload flow, OWASP rules, and 2026 storage prices."

### [Best Vercel Blob Alternatives in 2026](https://upstash.com/kb/best-vercel-blob-alternatives-in-2026)

**Date:** 2026-11-03  
**Topic:** Blob

"Vercel Blob alternatives compared on real pricing: Upstash Blob, R2, S3, Supabase, UploadThing, Tigris, Cloudinary and B2, with worked bills and migration code."

### [How TTL Jitter Protects Your Database When Redis Keys Expire Together](https://upstash.com/kb/redis-ttl-jitter)

**Date:** 2026-11-02  
**Topic:** Redis

We bulk-loaded a cache on real Upstash Redis and watched the keys expire, with and without TTL jitter. See how much jitter lowers the miss spike, how it protects the database behind the cache, and how wide to make it.

### [Why Lua Scripts Beat WATCH When Many Clients Update One Redis Key](https://upstash.com/kb/redis-watch-vs-lua)

**Date:** 2026-11-02  
**Topic:** Redis

We ran 1,000 updates on one Redis key with up to 100 clients using WATCH, Lua scripts and a plain read then write. See how much faster a script is, how many updates go missing without one, and how to keep scripts from stalling other clients.

### [How Big Should a Redis Key Be?](https://upstash.com/kb/redis-big-keys)

**Date:** 2026-11-02  
**Topic:** Redis

We grew Redis values and hashes on real Upstash databases to find how big a key can get. See where reads slow down, the 10 MB limit on one reply, the stall on a 1 million field hash, and how to split a big key.

### [How to List Keys in Redis Safely With SCAN](https://upstash.com/kb/redis-keys-vs-scan)

**Date:** 2026-11-02  
**Topic:** Redis

We ran KEYS and SCAN against 1 million keys on Upstash Redis and stock Redis 8. See how much SCAN helps, when KEYS stops working, what COUNT to use, and why a key prefix matters more than COUNT.

### [Why MGET Is Faster Than a Redis Pipeline for Reading Many Keys](https://upstash.com/kb/redis-pipeline-vs-mget)

**Date:** 2026-11-02  
**Topic:** Redis

We read 1,000 to 200,000 keys from a real Upstash Redis database with awaited GETs, pipelines and MGET. See how much each one speeds things up, what it costs in commands, where each one hits a limit, and how big to make a chunk.

### [What a sandbox protects you from, and what it doesn't](https://upstash.com/kb/what-a-sandbox-protects-you-from-and-what-it-doesnt)

**Date:** 2026-10-30  
**Topic:** Box

The standard response to "how can I run a coding agent safely" is "put it in a sandbox." To that end, Pillar Security spent some time in July 2026 attacking the sandboxes of Cursor, Codex, Gemini CLI and Antigravity. They found seven vulnerabilities across the four tools. And almost every time, the agent did not escape the sandbox.

### [How to Keep API Keys Out of Your Agent's Sandbox](https://upstash.com/kb/how-to-keep-api-keys-out-of-your-agents-sandbox)

**Date:** 2026-10-30  
**Topic:** Box

So you sandbox your coding agent. That way, a bad command won’t touch your laptop. To get it to do its job, you set OPENAIAPIKEY and GITHUBTOKEN environment variables, which the agent can then use. The sandbox protects the host, but it does nothing to protect the credentials that the agent can access.

### [What an Idle Agent Sandbox Actually Costs](https://upstash.com/kb/what-an-idle-agent-sandbox-actually-costs)

**Date:** 2026-10-30  
**Topic:** Box

Your coding agent sends a prompt. It waits. It then runs a test for a few seconds. Then, it waits some more. It’s even worse for scheduled agents. They’ll wake up, check their queue, find nothing, and then go back to sleep for 15 minutes. In the meantime, most sandboxes charge you for two vCPUs and four gigabytes of memory, just as if your agent had been compiling something the whole time.

### [Railway Redis vs Upstash: Which Redis for Your Railway App?](https://upstash.com/kb/railway-redis-vs-upstash-which-redis-for-your-railway-app)

**Date:** 2026-10-27  
**Topic:** Redis

If you have an app that's hosted on Railway and you want to use Redis for your cache, sessions, or for a queue, you can either add a Redis service to the Railway project with a few clicks, or use Upstash to provide a managed Redis database outside Railway. To connect your app to either Redis service, you'll need a standard Redis client, and a REDISURL environment variable.

### [How to Add Memory to an AI Agent with Redis](https://upstash.com/kb/how-to-add-memory-to-an-ai-agent-with-redis)

**Date:** 2026-10-27  
**Topic:** Redis

In order to add memory to an AI agent, you need to store things outside the model and load them into the prompt with every turn. When the model responds to your message, you need to write new things back to memory. For most agents, short-term memory (what you talked about most recently) and long-term memory (what you know about the user) are the most important.

### [Express Redis Cache: Add Upstash Redis to Any Node.js App](https://upstash.com/kb/express-redis-cache-add-upstash-redis-to-any-nodejs-app)

**Date:** 2026-10-26  
**Topic:** Redis

When an Express route reads from a slow database, every request waits for that query. A Redis cache keeps the result after the first request, so the next requests for the same data skip the database and take one round trip to Redis.

### [Cloudflare R2 Pricing in 2026: Storage, Operations, and Real Monthly Bills](https://upstash.com/kb/cloudflare-r2-pricing-in-2026-storage-operations-and-real-monthly-bills)

**Date:** 2026-10-26  
**Topic:** Blob

Cloudflare R2 is priced at $0.015 per GB per month for storage with no egress charges. That means if users download 20 TB of data from your R2 bucket in a month, that part of your bill will be $0. For S3, the same amount of data would be charged at $0.09 per GB after the first 100 GB.

### [The Best React File Upload Libraries in 2026](https://upstash.com/kb/best-react-file-upload-libraries)

**Date:** 2026-10-23  
**Topic:** Blob

We built the same uploader with eight React upload libraries and measured the JavaScript each one adds, then ran Upstash Blob's hook in a real browser with a 48 MB file, a pause and a page reload.

### [Thundering Herd Problem: How Cache Stampedes Happen and 5 Ways to Stop Them](https://upstash.com/kb/thundering-herd-problem-cache-stampede)

**Date:** 2026-10-23  
**Topic:** Redis

Of course, a cache only protects your database as long as the key is present. If you have a highly-accessed key expire during a high traffic period, you’ll have a stampede of requests that miss all at once in the subsequent few hundred milliseconds. All of those requests will then fall back to the database, exposing the database to the load the cache was meant to prevent.

### [Web Application Caching: Browser, CDN and Server-Side Caching Explained](https://upstash.com/kb/web-application-caching-browser-cdn-and-server-side-caching-explained)

**Date:** 2026-10-23  
**Topic:** Redis

A product page, which always reads the same row from the database, pays thousands of times per day for the same query. Caching stores a copy of the result near the user, so subsequent requests don’t have to do the work. A web application has a few different places to cache the result, each of which has a different expiry rule and mechanism for eviction.

### [How to Safely Run AI-Generated Code in a Code Sandbox: 7 Isolation Controls](https://upstash.com/kb/how-to-safely-run-ai-generated-code-in-a-code-sandbox-7-isolation-controls)

**Date:** 2026-10-22  
**Topic:** Box

LLMs are no longer just text generators. Today we have coding assistants, data analysts and chat apps that can write code on behalf of the user, which is executed immediately. This turns LLMs into a very powerful tool, but also introduces a new set of risks.

### [T3 Code vs herdr vs Conductor vs Cloudroom: Which Coding Agent App to Use](https://upstash.com/kb/t3-code-vs-herdr-vs-conductor-vs-cloudroom-which-coding-agent-app-to-use)

**Date:** 2026-10-19  
**Topic:** Box

Developers are currently running many coding agents at the same time: one creating a new feature, one reviewing it, one fixing the tests. The speed of the coding agents makes us the slow part. When you use Claude Code or Codex, you can open a new terminal tab for each of the coding agents, then open up each of those tabs and check if they’re done, or even if they’re waiting on your approval.

### [OpenCode vs Pi vs Gemini CLI vs CrewAI vs Goose: 9 agent harnesses compared](https://upstash.com/kb/opencode-vs-pi-vs-gemini-cli-vs-crewai-vs-goose-9-agent-harnesses-compared)

**Date:** 2026-10-19  
**Topic:** Box

OpenCode, Pi, Gemini CLI, Copilot CLI, Aider, Goose, Amp, Pydantic AI and CrewAI all promise the same thing: give a model a prompt and some tools, and it does the work. One-line summaries like "multi-provider coding agent", "git-aware code editor" or "type-safe agent framework" make them look like nine ways to do the same job. They behave very differently.

### [Vercel AI SDK vs TanStack AI: A Detailed Comparison](https://upstash.com/kb/vercel-ai-sdk-vs-tanstack-ai-comparing-type-safety-tools-streaming-and-performance)

**Date:** 2026-10-19  

If you want to add AI chat or an agent to your TypeScript application, the two main options are Vercel AI SDK and TanStack AI. The Vercel AI SDK provides a complete toolkit that is stable, with about 18.5 million npm downloads a week, has many providers, and offers pre-built agents. TanStack AI, on the other hand, consists of pluggable pieces and is a younger, strictly-typed tool with pieces you can swap out.
