Prerequisites
Before you begin, ensure you have:- A SambaCloud account with an active API key
- Docker Desktop 4.43.0+ or Docker Engine installed
- Docker Compose v2.38 or later, on every platform. The example uses the
modelstop-level element, which older versions of Compose do not recognize - A laptop with GPU support for running open models locally (alternatively, use Docker Offload if you don’t have a GPU)
Platform-specific requirements
- For Linux (Docker Engine) or Windows (Docker Desktop): Ensure Docker Model Runner requirements are met, specifically that GPU support is enabled and necessary drivers are installed
- For Linux (Docker Engine): Install Docker Compose version 2.38.1 or later
Setup
1
Clone the Repository
Clone the example repository and change into the project directory:This clones the default branch, so the example can change between runs. The agent image pins its dependencies in Verify the configuration parses before you start anything:It exits
agents/requirements.txt (google-adk==1.5.0 and litellm==1.73.6) and the local model is pinned to the ai/qwen3:8B-Q4_0 tag, so a rebuild reproduces the same stack.To hold a fixed starting point, record the commit you cloned and return to it later:0 and prints nothing when the file is valid. On a Compose older than v2.38 the models element is unrecognized and this is where you find out, rather than midway through a 4.8 GB pull.2
Configure Environment Variables
Create a
.env file in your project directory with the following configuration:SAMBANOVA_BASE_URL must end in /v1. The agents call SambaNova through an OpenAI-compatible client, which expects the versioned path.Set SAMBANOVA_CHAT_MODEL to match the flow you plan to run, because no current SambaCloud model covers both:See SambaCloud models for the full list and for the Preview designation that applies to
gemma-4-31B-it.3
Define Agent Prompts
All agent prompts are defined in the The three
compose.yml file. Customize agent behaviors, roles, and capabilities by modifying the prompts in this configuration file to match your use case.The file has two parts. The models top-level element declares the open model that Compose serves locally, and the service-level models block tells Compose which environment variables to inject so the container can reach it:${...} values are the ones you set in .env. MODEL_RUNNER_URL and MODEL_RUNNER_MODEL are generated by Compose from the models element, so do not set them yourself.Only the SambaNova agent runs on SambaCloud. The Developer agent runs on the locally served
ai/qwen3:8B-Q4_0 model, which is why the GPU and Docker Model Runner prerequisites apply.4
Start the Services
Launch the Docker Compose stack:If you’ve updated the code or configuration, rebuild the containers:The application is available at http://localhost:8000.To confirm the stack came up, list the running services:The That means the stack exited during startup rather than failing to start, so the logs still hold the reason. Check
The first run pulls the
ai/qwen3:8B-Q4_0 model, about 4.8 GB, before the agents start. Allow 10–15 minutes. Later runs reuse the cached model and start in seconds.main-agent service should be listed with a STATUS of Up and 0.0.0.0:8000->8000/tcp under PORTS. If you see only the header row, nothing is running:docker compose logs and see Troubleshooting.Usage
The agents can be accessed through both the web interface and API endpoints.Example workflow
Enable Token Streaming for real-time responses, then follow these steps:This workflow crosses both model capabilities: step 1 needs image input and step 3 needs tool calling. Run steps 1 and 2 with
SAMBANOVA_CHAT_MODEL=gemma-4-31B-it, then switch to a tool-calling model such as Meta-Llama-3.3-70B-Instruct and restart the stack to exercise step 3. Because containers read environment variables at startup, changing .env requires docker compose down followed by docker compose up.1
Upload an Image
Upload an image such as an application architecture diagram, system design, or workflow visualization through the web interface.
2
Interact with the SambaNova Agent
Ask the SambaNova agent to analyze and explain the uploaded content:Replies from this agent begin with
SAMBANOVA_AGENT SPEAKING:, which is set by the prompt in compose.yml and is a quick way to confirm which agent answered.3
Request Code Generation
Use the Developer agent to generate code based on the analysis:This step is a handoff, so it requires a tool-calling model. You know the handoff succeeded when the reply comes from the Developer agent, which runs on the local
ai/qwen3:8B-Q4_0 model rather than on SambaCloud. If the SambaNova agent answers instead, the handoff was dropped; see Troubleshooting.Multi-agent collaboration
The Docker Compose setup enables multiple specialized agents to work together:- SambaNova Agent: Analyzes images, documents, and provides architectural insights
- Developer Agent: Generates code based on specifications and requirements
- Custom Agents: Define your own agents with specific roles and capabilities
Architecture
Docker Compose for Agents allows you to define:- AI Models: SambaNova models for inference and reasoning
- Agent Services: Specialized agents with distinct roles and prompts
- Supporting Services: Databases, message queues, storage, and other infrastructure
- Tool Integration: Connect agents to external APIs, databases, and services
compose.yml file, making it easy to:
- Version control your entire agent architecture
- Scale services independently
- Deploy consistently across environments
- Share configurations with your team
Benefits
Docker Compose for Agents with SambaNova combines containerization best practices with high-performance AI inference to deliver:- Familiar workflow: Use the same Docker Compose syntax you already know
- Simplified deployment: Define complex multi-agent systems in a single YAML file
- Local development: Test and iterate quickly on your local machine
- Production-ready: Deploy to production with the same configuration
- Flexible architecture: Easily add, remove, or modify agents and services
- High-performance inference: Leverage SambaNova’s optimized models for fast response times
Troubleshooting
Authentication errors from the SambaNova agent
Authentication errors from the SambaNova agent
- Confirm
SAMBANOVA_API_KEYis set in the.envfile in your project directory, since Compose reads values from there. - An empty value is not the same as a missing one. Compose substitutes a blank string for an unset variable and starts anyway, so the agents come up without credentials and fail on the first request rather than at startup.
- Regenerate the key in the SambaCloud portal.
- Containers read environment variables at startup, so after editing
.envrundocker compose downfollowed bydocker compose upto apply the change.
An error mentions OPENAI_API_KEY or api.openai.com
An error mentions OPENAI_API_KEY or api.openai.com
- This points at the Developer agent, not your SambaNova key. That agent talks to the locally served model through an
openai-prefixed client whose address comes fromMODEL_RUNNER_URL, which Compose generates from themodelselement. - When that address is empty, the client falls back to OpenAI’s public endpoint, which produces an OpenAI-flavored error. Treat it as a signal that Docker Model Runner is not serving the model.
- Confirm your Compose version is v2.38 or later, since older versions ignore the
modelselement and never inject the variable. - Confirm Docker Model Runner is enabled with GPU support.
First run appears to hang
First run appears to hang
- The first
docker compose uppulls theai/qwen3:8B-Q4_0model, about 4.8 GB, before the agents start. Allow 10–15 minutes. - Follow progress with
docker compose logs -f.
GPU or Docker Model Runner errors
GPU or Docker Model Runner errors
- The stack runs an open model locally and requires Docker Model Runner with GPU support enabled.
- On Linux (Docker Engine) or Windows (Docker Desktop), confirm the Model Runner requirements are met and the necessary drivers are installed.
- Without a GPU, use Docker Offload instead.
Port 8000 already in use
Port 8000 already in use
- Run
docker compose psto check whether an earlier run is still active, then stop it withdocker compose down. - Otherwise, change the host port in the
portsmapping incompose.yml.
Model not found
Model not found
- Set
SAMBANOVA_CHAT_MODELto a model ID served by SambaCloud. See SambaCloud models for the current list. If you copied the value from.env.example, it names a retired model. - For the image steps, use
gemma-4-31B-it. The other current models accept text only and fail once you attach an image, so switching to one of them replaces this error with a less obvious one. - Use the bare model ID without a
sambanova/prefix. The agent adds the provider prefix itself, so a prefixed value resolves tosambanova/sambanova/...and fails.
The Developer agent never takes over
The Developer agent never takes over
- Asking for the Developer agent is a handoff, and the coordinating agent performs it with a tool call. If
SAMBANOVA_CHAT_MODELnames a model that does not support tool calling, the call is dropped and the SambaNova agent answers the request itself. Nothing in the logs reports an error. gemma-4-31B-itis not a tool-calling model. SetSAMBANOVA_CHAT_MODELto a model listed in Function calling, such asMeta-Llama-3.3-70B-Instruct, then rundocker compose downanddocker compose up.- That model accepts text only, so exercise the handoff with a text description rather than an uploaded image.
The SAMBANOVA_API_KEY variable is not set warning
The SAMBANOVA_API_KEY variable is not set warning
- The full text is
warning msg="The \"SAMBANOVA_API_KEY\" variable is not set. Defaulting to a blank string.", and Compose prints one line per missing variable. Because it defaults each to a blank string and continues, the agents start without credentials instead of failing fast. - The
.envfile must be in the directory you rundocker compose upfrom, which isintegrations/docker-compose-for-agents. Compose does not search parent directories. - Confirm the file is present with
ls -a, since.envis hidden from a plainls.

