Setup & Prerequisites¶
Get a clean Python environment and an API key so every example in Bee just works.
Overview¶
You need three things: Python 3.10+, an isolated environment (so projects don't clash), and an API key. This page sets all three up in about five minutes.
Learning Objectives¶
After this page you will be able to:
- Create an isolated Python environment with
uv(orvenv). - Store an API key safely using a
.envfile. - Verify your setup with a one-line check.
1. Install Python 3.10+¶
Check what you have:
If it's older than 3.10 (or missing), install a current version from
python.org or via your package manager
(brew install python, apt install python3).
2. Choose an environment tool¶
We recommend uv โ it's fast and manages both Python versions
and dependencies. Standard venv + pip works everywhere too.
Why isolate?
A virtual environment keeps each project's dependencies separate, so upgrading one project
never breaks another. Never pip install into your system Python.
3. Get an API key¶
Bee's examples default to Anthropic, but any provider works โ the concepts are the same.
- Create an account with a provider (e.g. Anthropic Console).
- Generate an API key.
- Never commit it. Store it in a
.envfile (which is git-ignored):
Load it in Python with python-dotenv:
import os
from dotenv import load_dotenv
load_dotenv() # reads .env into environment variables
api_key = os.environ["ANTHROPIC_API_KEY"]
Protect your key
An API key is a password that can spend real money. Never paste it into code, commit it, or share it in an issue. If a key leaks, revoke it immediately in your provider's console.
4. Verify your setup¶
If that prints the success message, you're ready.
Best Practices¶
- โ One virtual environment per project.
- โ
Keep secrets in
.env; commit a.env.examplewith placeholder values. - โ Pin dependency versions so examples stay reproducible.
Common Mistakes¶
- โ Installing packages globally โ leads to version conflicts. Use a venv.
- โ Committing your
.envโ add it to.gitignore(Bee's already does). - โ Hardcoding the API key in your script โ load it from the environment.
Exercises¶
- Create a fresh environment and install the
anthropicSDK. - Add your key to a
.envfile and load it in a script โ print only the length of the key to confirm it loaded (never print the key itself).
References¶
Next: Your First LLM Call โ