Quickstart (Docker Compose)
Get a forked Strands Base Agent running in a container in under five minutes. This is the lower-friction path when you don't want to install Python 3.14+ and uv locally — Docker builds the image and runs the agent the same way it will run in higher environments.
For active development, where you restart the server after each code change without rebuilding an image, see the Local Python quickstart instead.
Prerequisites
- Docker Desktop (or any Docker engine) with Compose 2.8.0 or newer. Check with
docker compose version. Older versions stop withInvalid template, becausecompose.yamluses${OS:+...}, which Compose added in 2.8.0. - AWS credentials with Bedrock access — typically AWS SSO logged in via
~/.aws/sso/cache/ - Access to install
foundry-agent-*packages from the package locations configured inpyproject.toml(used during the image build)
Install
-
Clone (or fork) the repository:
git clone <repo-url>cd strands-base-agent -
Configure the environment:
cp env.template .envAt minimum, set:
STRANDS_API_KEY— generate withpython -c "import secrets; print(secrets.token_urlsafe(32))".AWS_PROFILE— a profile in~/.aws/configthat has Bedrock access.
The compose file bind-mounts
~/.awsinto the container so SSO sessions are reused without copying credentials into the image.On WSL, load
compose.wsl.yamltoo, so the container can read your~/.aws.just updoes this for you. See Run.On Windows (PowerShell or Command Prompt),
compose.yamlshares~/.awsread-only. It does this whenOSis set, which Windows does in every shell. This stops the container from rewriting your AWS login, which would make it unreadable in WSL if WSL shares your Windows.awsfolder. Because the container can't write~/.aws, it can't refresh your SSO login itself. AWS calls fail in the login's last 15 minutes.To keep the login fresh, run
aws sso login --profile <profile>on Windows every 20 minutes, where<profile>is theAWS_PROFILEvalue from.env. Do this while you use the container. If your browser is still signed in to the AWS access portal, it finishes without asking you to sign in again. The container picks up the new login without a restart. If your login lasts less than 40 minutes, run it more often. TheexpiresAtvalue in the newest file in~/.aws/sso/cache/shows when your current login ends.If you miss a run, queries return a 500 and
docker compose logs strands-agentshowsTokenRetrievalError. Runaws sso login --profile <profile>on Windows to fix it.Known limitation: in the login's last 15 minutes, the container still asks AWS for a new token, but it can't save it. If AWS cancels the old token when it issues the new one, AWS calls on Windows fail too. Running
aws sso login --profile <profile>every 20 minutes keeps the login out of its last 15 minutes, which avoids this.On Linux (not WSL), your
~/.awsis readable only by you, so the container's built-in user (UID65532) can't read it. Run the container as you instead. Add this line to your shell profile (~/.bashrcor~/.zshrc), then open a new terminal:export STRANDS_HOST_UID="$(id -u)" STRANDS_CONTAINER_HOME=/aws-homeThis shares
~/.awsat/aws-home/.aws, because/home/nonrootin the image is reachable only by UID65532. With these set, file-backed sessions (session_type: file) and tools that write under$HOME(such as MCP servers started withuvxornpx) aren't supported. Don't add it to root's profile, which would setSTRANDS_HOST_UIDto0.Optional, WSL only:~/.awsshared from your Windows profileSkip this on Mac, Windows, and Linux. On WSL, run it only if one of these applies:
- your WSL
~/.aws(sso,cli,config, orcredentials) links to your Windows.awsfolder id -uprints something other than1000
In WSL, from the repo folder:
if [ "$(id -u)" -eq 0 ]; thenecho "Run this as your normal WSL user, not root."elif [ ! -f .env ]; thenecho "Create .env first: cp env.template .env"else[ -z "$(tail -c1 .env)" ] || echo >> .envsed -i '/^\(STRANDS_HOST_UID\|AWS_LINK_[A-Z]*\)=/d' .envif [ "$(id -u)" -ne 1000 ]; then printf 'STRANDS_HOST_UID=%s\n' "$(id -u)" >> .env; fifor f in sso cli config credentials; dot=$(readlink ~/.aws/$f) || continuecase "$t" in/*) if [ -e "$t" ]; then printf "AWS_LINK_%s='%s'\n" "$(echo "$f" | tr a-z A-Z)" "$(printf '%s' "$t" | sed "s/'/\\\\'/g")" >> .envelse echo "Skipped ~/.aws/$f: $t doesn't exist. Create it on Windows first (for sso, run aws sso login there), then rerun this."; fi ;;*) echo "Note: ~/.aws/$f is a relative link. It works in the container only if it points inside ~/.aws." ;;esacdonegrep -E '^(STRANDS_HOST_UID|AWS_LINK_[A-Z]*)=' .envfiThis adds lines to
.envthat share the Windows paths your~/.awslinks point to and setSTRANDS_HOST_UIDif needed. Then continue with step 3.With
compose.wsl.yaml, file-backed sessions (session_type: file) and tools that write under$HOME(such as MCP servers started withuvxornpx) aren't supported. Never setSTRANDS_HOST_UIDto0. -
Edit
config.yamlwith your model and agent settings:model:provider: bedrockmodel_id: us.anthropic.claude-haiku-5-5agent_name: my-agentsystem_prompt: >You are an AI assistant specialized in your domain.config.yaml is baked in at build timeconfig.yamlisCOPY'd into the image by theDockerfile. After editing it, rebuild withdocker compose up --build(ordocker compose build) — restarting alone won't pick up the change. On WSL, rebuild withdocker compose -f compose.yaml -f compose.wsl.yaml up --buildinstead, or the container loses its WSL settings and can't read your AWS login. Secrets and per-environment values come from.envat run time and don't require a rebuild.
Run
Build the image and start the agent.
macOS, Linux, and Windows:
docker compose up --build
WSL:
docker compose -f compose.yaml -f compose.wsl.yaml up --build
just up also loads compose.wsl.yaml on WSL, but it doesn't rebuild.
The first build pulls foundry-agent-* packages from the package locations configured in pyproject.toml — make sure your network can reach them. Subsequent runs without --build start instantly.
Verify
In another terminal, hit the health endpoint. If you set PORT in .env, use that port instead of 8000 here and in the query below.
curl http://localhost:8000/api/v1/health
You should receive a JSON response with "status": "healthy". The compose file also runs this same check internally — docker compose ps shows the container as healthy once it passes.
Then test a query:
curl -X POST http://localhost:8000/api/v1/query \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <your-key>" \
-d '{"query": "What is machine learning?"}' | jq .
What's mounted, what persists
The default compose.yaml wires up two volumes:
| Mount | Source | Purpose |
|---|---|---|
~/.aws (bind) | host | Reuse host AWS SSO sessions inside the container (read-only on Windows; on WSL, Windows, and Linux, see the notes above) |
strands_sessions (named) | docker volume | Persist FileSessionManager state across restarts (not writable under compose.wsl.yaml or with STRANDS_HOST_UID set) |
Sessions survive docker compose down. To wipe them, docker compose down -v.
On WSL, compose.wsl.yaml adds a second share of ~/.aws at /aws-home/.aws, which is the one the container uses, plus one share for each AWS_LINK_* path you set.
Tuning the compose file
compose.yaml ships with sensible defaults; common customizations:
- Port — set
PORTin.envto change the host port and avoid collisions with other agents on the same machine. Under compose,PORTis the host port only. The agent always listens on 8000 inside the container, so the health check andEXPOSE 8000stay correct. Compose also pinsSTRANDS__AGENT_PORTto 8000, so setting it in.env, or settingagent_portinconfig.yaml, has no effect under compose. APORTset in your shell, such as$env:PORTin PowerShell, takes precedence over the one in.env. - Container / service name — rename the
strands-agentservice to your agent's name so logs anddocker compose psare easier to read. Rename it incompose.wsl.yamltoo, or WSL users get a separate, brokenstrands-agentservice. - Extra Compose files — Compose loads
compose.override.yamlautomatically, except when you pass-f, asjust updoes on WSL. On WSL, add-f compose.override.yamlafter the other files. - Network — the file declares a network named
DockerAINetwork; mark itexternal: trueif you're sharing it with other agents or services. - Health check cadence —
interval: 10s,timeout: 5s,retries: 5by default; tune if startup is slow in your environment.
See Configuration → Docker Configuration for the full set of compose-related settings.
What's Next
- Configuration — full reference for
config.yamland env var overrides - Adding tools — give your agent domain-specific capabilities
- Customizing the server — wire in custom session managers or model providers