### Run Agno GitHub Issue Analyzer Demo Source: https://context7.com/docker/compose-for-agents/llms.txt Instructions to set up a GitHub token and run the Agno GitHub Issue Analyzer demo. This involves copying an example environment file, adding your personal access token, and then starting the Docker containers. ```bash # Setup GitHub token cp .mcp.env.example .mcp.env echo "github.personal_access_token=ghp_XXXXX" >> .mcp.env # Run the Agno demo cd agno docker compose up --build # Open http://localhost:3000 # Try: "summarize the issues in the repo microsoft/vscode" ``` -------------------------------- ### Create Agent UI Project Source: https://github.com/docker/compose-for-agents/blob/main/agno/agent-ui/README.md Use this command to automatically set up a new Agent UI project. This is the recommended installation method. ```bash npx create-agent-ui@latest ``` -------------------------------- ### Clone Repository and Navigate Source: https://github.com/docker/compose-for-agents/blob/main/minions/README.md Clone the MinionS repository and navigate to the Docker setup directory. ```bash git clone https://github.com/HazyResearch/minions.git cd minions/apps/minions-docker ``` -------------------------------- ### Example User Prompts for Agents Source: https://github.com/docker/compose-for-agents/blob/main/adk-cerebras/README.md These examples demonstrate how to interact with the agents for code generation, analysis, and testing. Specific commands can route requests to Bob or Cerebras. ```text Hello I'm Phil Bob generate a gloang hello world program Add a human struct with a hello method Cerebras can you analyse and comment this code Can you generate the tests ``` -------------------------------- ### Start Project with OpenAI Configuration Source: https://github.com/docker/compose-for-agents/blob/main/README.md Use this command to start your project when integrating with OpenAI models. It specifies the main compose file and the OpenAI-specific configuration file. ```sh docker compose -f compose.yaml -f compose.openai.yaml up ``` -------------------------------- ### Run the Project Source: https://github.com/docker/compose-for-agents/blob/main/langgraph/README.md Execute this command to start the AI agent, set up the PostgreSQL database, load the pre-seeded Chinook.db, and begin answering questions. ```sh docker compose up ``` -------------------------------- ### Install Agent UI Dependencies Source: https://github.com/docker/compose-for-agents/blob/main/agno/agent-ui/README.md Install project dependencies after cloning the repository. Ensure you have pnpm installed. ```bash pnpm install ``` -------------------------------- ### Navigate and Run Docker Compose Demo Source: https://context7.com/docker/compose-for-agents/llms.txt Standard commands to navigate to a demo directory, start it with Docker Compose, and clean up afterwards. Includes a step for handling API keys if required. ```bash # Navigate to any demo directory cd adk # or a2a, agno, crew-ai, langgraph, etc. # Start the demo (no configuration required for most demos) docker compose up --build # For demos requiring API keys, create the secret file first echo "sk-your-openai-key" > secret.openai-api-key docker compose up --build # Stop and cleanup docker compose down -v ``` -------------------------------- ### Start Agent UI Development Server Source: https://github.com/docker/compose-for-agents/blob/main/agno/agent-ui/README.md Run the development server to view the Agent UI in your browser. Access it at http://localhost:3000. ```bash pnpm dev ``` -------------------------------- ### Start Docker Compose Services Source: https://github.com/docker/compose-for-agents/blob/main/adk-cerebras/README.md Use this command to launch all agent services defined in the Docker Compose file. Use the --build flag if you have updated the code. ```bash docker compose up # if you updated the code, use --build ``` -------------------------------- ### Build and Run Docker Compose Source: https://github.com/docker/compose-for-agents/blob/main/akka/README.md Builds the Docker images and starts the services defined in the docker-compose.yml file. Access the agent at http://localhost:9000. ```sh docker compose up --build ``` -------------------------------- ### Model Customization Example Source: https://github.com/docker/compose-for-agents/blob/main/minions/README.md Configuration snippet for docker-compose.minions.yml showing how to switch between 'ai/qwen3' (8B parameters, better accuracy) and 'ai/llama3.2' (3B parameters, faster download). ```yaml # In docker-compose.minions.yml models: worker: model: ai/qwen3 # 8B parameters - better accuracy # model: ai/llama3.2 # 3B parameters - faster download context_size: 10000 ``` -------------------------------- ### Clone Agent UI Repository Source: https://github.com/docker/compose-for-agents/blob/main/agno/agent-ui/README.md Manually clone the Agent UI repository to your local machine. This is an alternative to the automatic installation. ```bash git clone https://github.com/agno-agi/agent-ui.git cd agent-ui ``` -------------------------------- ### Run LangGraph SQL Demo Source: https://context7.com/docker/compose-for-agents/llms.txt Command to run the LangGraph SQL agent demo. This will start a Docker container that queries the Chinook database. ```bash # Run the LangGraph SQL demo cd langgraph docker compose up # The agent queries the Chinook database # Example questions: "Who was the best-selling sales agent in 2010?" ``` -------------------------------- ### Define Model Service in Compose Source: https://github.com/docker/compose-for-agents/blob/main/adk-sock-shop/CLAUDE.md Example of how to define a model service within a docker-compose.yaml file, specifying the model image reference. ```yaml models: : model: ``` -------------------------------- ### Run Project Locally with Docker Compose Source: https://github.com/docker/compose-for-agents/blob/main/embabel/README.md Set environment variables for OpenAI, Anthropic, and Brave API keys. Then, start the travel agent planner application using Docker Compose. ```sh export OPENAI_API_KEY=your_openai_api_key_here export ANTHROPIC_API_KEY=your_anthropic_api_key_here export BRAVE_API_KEY=your_brave_api_key_here docker compose --profile in-docker up ``` -------------------------------- ### Configure Model Usage in Service Source: https://github.com/docker/compose-for-agents/blob/main/adk-sock-shop/CLAUDE.md Example of how to configure a service to use a specific model by defining endpoint and model variables in docker-compose.yaml. ```yaml models: : endpoint_var: MODEL_RUNNER_URL model_var: MODEL_RUNNER_MODEL ``` -------------------------------- ### Configure MCP Gateway Service Source: https://github.com/docker/compose-for-agents/blob/main/adk-sock-shop/CLAUDE.md Example configuration for an MCP gateway service in a docker-compose.yaml file. Specifies transport, servers, and configuration paths. ```yaml mcp-gateway: image: docker/mcp-gateway:latest use_api_socket: true command: - --transport=sse - --servers=server1,server2,server3 - --config=/mcp_config - --secrets=docker-desktop:/run/secrets/mcp_secret secrets: - mcp_secret ``` -------------------------------- ### Define MCP Secret Configuration Source: https://github.com/docker/compose-for-agents/blob/main/adk-sock-shop/CLAUDE.md Example configuration for the MCP secret in a docker-compose.yaml file. This points to a local environment file for secrets. ```yaml secrets: mcp_secret: file: ./.mcp.env ``` -------------------------------- ### Customize Model in docker-compose.minions.yml Source: https://github.com/docker/compose-for-agents/blob/main/minions/README.md Edit the docker-compose.minions.yml file to specify the desired local model. This example changes the model to 'ai/qwen3' for better accuracy. ```yaml models: worker: model: ai/qwen3 # Changed from ai/llama3.2 for better accuracy (8B vs 3B params) context_size: 10000 ``` -------------------------------- ### ADK Demo Docker Compose Configuration Source: https://context7.com/docker/compose-for-agents/llms.txt Configures the Docker Compose setup for the ADK demo, defining services for the ADK agent and MCP gateway, including port mappings, environment variables, and model configurations. ```yaml # adk/compose.yaml services: adk: build: context: . ports: - 8080:8080 environment: - MCPGATEWAY_ENDPOINT=http://mcp-gateway:8811/sse depends_on: - mcp-gateway models: gemma3: endpoint_var: MODEL_RUNNER_URL model_var: MODEL_RUNNER_MODEL mcp-gateway: image: docker/mcp-gateway:latest use_api_socket: true command: - --transport=sse - --servers=duckduckgo models: gemma3: model: ai/gemma3:4B-Q4_0 context_size: 10000 ``` -------------------------------- ### CrewAI Marketing Team Setup Source: https://context7.com/docker/compose-for-agents/llms.txt Python code defining a CrewAI marketing team with specialized agents for market analysis, strategy, and content creation. It uses Pydantic for data modeling and CrewBase for agent and task configuration. ```python # crew-ai/src/marketing_posts/crew.py from crewai import Agent, Crew, Process, Task from crewai.project import CrewBase, agent, crew, task from pydantic import BaseModel, Field class MarketStrategy(BaseModel): name: str = Field(..., description="Name of the market strategy") tactics: List[str] = Field(..., description="List of tactics") channels: List[str] = Field(..., description="List of channels") KPIs: List[str] = Field(..., description="List of KPIs") @CrewBase class MarketingPostsCrew: agents_config = "config/agents.yaml" tasks_config = "config/tasks.yaml" @agent def lead_market_analyst(self) -> Agent: return Agent( config=self.agents_config["lead_market_analyst"], tools=get_tools(), verbose=True, ) @agent def chief_marketing_strategist(self) -> Agent: return Agent( config=self.agents_config["chief_marketing_strategist"], tools=get_tools(), verbose=True, ) @task def marketing_strategy_task(self) -> Task: return Task( config=self.tasks_config["marketing_strategy_task"], agent=self.chief_marketing_strategist(), output_json=MarketStrategy, ) @crew def crew(self) -> Crew: return Crew( agents=self.agents, tasks=self.tasks, process=Process.sequential, verbose=True, ) ``` -------------------------------- ### Append Chat Message Stream Start Source: https://github.com/docker/compose-for-agents/blob/main/akka/src/main/resources/static-resources/index.html Initializes the display for a streaming bot message by creating a new message div and a bot bubble. Returns the bubble element to append subsequent stream parts. ```javascript function appendMessageStreamStart() { const msgDiv = document.createElement('div'); msgDiv.className = 'chat-message bot'; const bubble = document.createElement('span'); bubble.className = 'bubble bot-bubble'; bubble.innerHTML = `Chatbot:
`; msgDiv.appendChild(bubble); chatBox.appendChild(msgDiv); chatBox.scrollTop = chatBox.scrollHeight; return bubble; } ``` -------------------------------- ### Agno GitHub Issue Analyzer Configuration Source: https://context7.com/docker/compose-for-agents/llms.txt Docker Compose configuration for the Agno GitHub Issue Analyzer. This setup defines services for agents, a UI, and an MCP gateway, specifying image sources, ports, environment variables, volumes, and secrets. ```yaml # agno/compose.yaml services: agents: image: demo/agents build: context: agent ports: - 7777:7777 environment: - MCPGATEWAY_URL=http://mcp-gateway:8811 volumes: - ./agents.yaml:/agents.yaml models: qwen3-small: endpoint_var: MODEL_RUNNER_URL model_var: MODEL_RUNNER_MODEL agents-ui: image: demo/ui build: context: agent-ui ports: - 3000:3000 environment: - AGENTS_URL=http://localhost:7777 mcp-gateway: image: docker/mcp-gateway:latest use_api_socket: true command: - --transport=streaming - --secrets=docker-desktop:/run/secrets/mcp_secret - --servers=github-official secrets: - mcp_secret models: qwen3-small: model: ai/qwen3:8B-Q4_0 context_size: 15000 secrets: mcp_secret: file: ./.mcp.env ``` -------------------------------- ### Clone Project and Initialize Environment Source: https://github.com/docker/compose-for-agents/blob/main/vercel/README.md Clone the project repository and create a placeholder environment file. This step is temporary until cloud secret support is fully implemented. ```bash git clone git@github.com:slimslenderslacks/scira-mcp-chat.git cd scira-mcp-chat # create a blank .mcp.env for now (will remove this step once cloud has secret support) touch .mcp.env ``` -------------------------------- ### Switching to OpenAI for LLM Inference Source: https://context7.com/docker/compose-for-agents/llms.txt Demonstrates how to configure demos to use OpenAI for LLM inference instead of local models. Requires creating a secret file for the OpenAI API key. ```bash # Create the OpenAI API key secret file echo "sk-your-openai-api-key" > secret.openai-api-key # Run with OpenAI configuration docker compose -f compose.yaml -f compose.openai.yaml up # For demos that already require OpenAI (like a2a), just run normally docker compose up --build ``` -------------------------------- ### Run ADK Demo Source: https://context7.com/docker/compose-for-agents/llms.txt Instructions to run the ADK demo using Docker Compose and access it via a local URL. Assumes the user is in the 'adk' directory. ```bash # Run the ADK demo cd adk docker compose up --build # Open http://localhost:8080 and ask: "Is the universe infinite?" ``` -------------------------------- ### Run A2A Demo Source: https://context7.com/docker/compose-for-agents/llms.txt This command initiates the A2A demo. Ensure you have an OpenAI API key set up. ```bash cd a2a echo "sk-your-openai-key" > secret.openai-api-key docker compose up --build # Open http://localhost:8080 ``` -------------------------------- ### Langchaingo with MCP Tools for Web Search Source: https://context7.com/docker/compose-for-agents/llms.txt Demonstrates using Langchaingo with MCP tools for web search. Requires setting QUESTION, API key, base URL, and model name environment variables. ```go // langchaingo/main.go package main import ( "github.com/modelcontextprotocol/go-sdk/mcp" "github.com/tmc/langchaingo/llms" "github.com/tmc/langchaingo/llms/openai" "github.com/tmc/langchaingo/tools" ) func main() { question := os.Getenv("QUESTION") mcpGatewayURL := os.Getenv("MCP_GATEWAY_URL") result, err := chat(question, mcpGatewayURL, apiKey, baseURL, modelName) if err != nil { log.Fatalf("Failed to chat: %v", err) } log.Println("ASSISTANT:", result) } func initializeLLM(apiKey, baseURL, modelName string) (llms.Model, error) { return openai.New( openai.WithToken(apiKey), openai.WithBaseURL(baseURL), openai.WithModel(modelName), ) } func initializeMCPTools(client *mcp.Client, mcpGatewayURL string) ([]tools.Tool, error) { transport := mcp.NewSSEClientTransport(mcpGatewayURL, nil) cs, err := client.Connect(context.Background(), transport) if err != nil { return nil, fmt.Errorf("connect to MCP gateway: %v", err) } mcpTools, err := cs.ListTools(context.Background(), &mcp.ListToolsParams{}) if err != nil { return nil, fmt.Errorf("list tools: %v", err) } toolBelt := make([]tools.Tool, len(mcpTools.Tools)) for i, tool := range mcpTools.Tools { toolBelt[i] = &DuckDuckGoTool{ clientSession: cs, mcpTool: tool, } } return toolBelt, nil } ``` ```bash # Run the Langchaingo demo cd langchaingo docker compose up # Run tests with Testcontainers go test -v ./... # Run specific test types go test -v -run TestChat_embeddings ./... go test -v -run TestChat_usingEvaluator ./... ``` -------------------------------- ### Using Docker Offload for GPU Acceleration Source: https://context7.com/docker/compose-for-agents/llms.txt Explains how to use Docker Offload to run demos on remote GPU instances for increased GPU power. Requires specific compose files. ```bash # Run any demo with Docker Offload docker compose -f compose.yaml -f compose.offload.yaml up --build ``` -------------------------------- ### Build and Run Agents with ADK Source: https://context7.com/docker/compose-for-agents/llms.txt Navigate to the ADK directory and build the Docker Compose services using specific configuration files. ```bash cd adk docker compose -f compose.yaml -f compose.offload.yaml up --build ``` -------------------------------- ### Run CrewAI Marketing Demo Source: https://context7.com/docker/compose-for-agents/llms.txt Command to execute the CrewAI marketing team demo. This will build and run Docker containers for the agents to collaborate on marketing tasks. ```bash # Run the CrewAI marketing demo cd crew-ai docker compose up --build # Agents collaborate to produce marketing strategy, campaigns, and ad copy ``` -------------------------------- ### Launch MinionS Protocol with Docker Compose Source: https://github.com/docker/compose-for-agents/blob/main/minions/README.md Build and launch the MinionS protocol using Docker Compose with the specified configuration file. ```bash docker compose -f docker-compose.minions.yml up --build ``` -------------------------------- ### Initialize Docker Environment for ARM64 Source: https://github.com/docker/compose-for-agents/blob/main/adk-sock-shop/README.md If running on an ARM64 macOS machine, use this command to pull the correct Docker image platform. This ensures compatibility for the roberthouse224/catalogue image. ```sh DOCKER_DEFAULT_PLATFORM=linux/amd64 docker pull roberthouse224/catalogue ``` -------------------------------- ### Run Project with Docker Offload and Local LLM Source: https://github.com/docker/compose-for-agents/blob/main/a2a/README.md Combine Docker Compose files to run the project with Docker Offload and a local LLM, utilizing GPU support. ```sh docker compose -f compose.dmr.yaml -f compose.offload.yaml up --build ``` -------------------------------- ### Set API Keys and Gateway Secrets Source: https://github.com/docker/compose-for-agents/blob/main/adk-sock-shop/README.md Export necessary API keys for Brave, Resend, and OpenAI, then run the make command to set gateway secrets. Ensure these keys are valid before proceeding. ```sh export BRAVE_API_KEY= export RESEND_API_KEY= export OPENAI_API_KEY= make gateway-secrets ``` -------------------------------- ### Build ADK Multi-Platform Image Source: https://github.com/docker/compose-for-agents/blob/main/adk-sock-shop/CLAUDE.md Use this command to build and push the multi-platform Docker image for the ADK. Requires the hydrobuild builder. ```bash make build-adk-image ``` -------------------------------- ### Run Project with Local LLM Inference Source: https://github.com/docker/compose-for-agents/blob/main/a2a/README.md Use an alternative Docker Compose file to run the project with a local LLM for inference. ```sh docker compose -f compose.dmr.yaml up ``` -------------------------------- ### Spring AI with MCP Integration for Web Search Source: https://context7.com/docker/compose-for-agents/llms.txt Integrates Spring AI with Model Context Protocol for web search using DuckDuckGo. Requires setting the QUESTION environment variable. ```java // spring-ai/src/main/java/org/springframework/ai/mcp/samples/brave/Application.java @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args).close(); } @Bean public CommandLineRunner predefinedQuestions( ChatClient.Builder chatClientBuilder, List mcpSyncClients) { return args -> { var chatClient = chatClientBuilder .defaultToolCallbacks(new SyncMcpToolCallbackProvider(mcpSyncClients)) .build(); String question = System.getenv("QUESTION"); logger.info("QUESTION: {}", question); logger.info("ASSISTANT: {}", chatClient.prompt(question).call().content()); }; } } ``` ```yaml # spring-ai/compose.yaml services: app: build: target: app ports: - 8080:8080 environment: - SPRING_PROFILES_ACTIVE=prod - MCP_GATEWAY_URL=http://mcp-gateway:8811 - QUESTION="Does Spring AI supports the Model Context Protocol?" models: gemma: endpoint_var: MODEL_RUNNER_URL model_var: MODEL_RUNNER_MODEL mcp-gateway: image: docker/mcp-gateway:latest use_api_socket: true command: - --transport=sse - --servers=duckduckgo - --tools=search,fetch_content models: gemma: model: ai/gemma3-qat ``` ```bash # Run the Spring AI demo cd spring-ai docker compose up # The agent answers questions using DuckDuckGo search ``` -------------------------------- ### Initialize Chat Interface Elements Source: https://github.com/docker/compose-for-agents/blob/main/akka/src/main/resources/static-resources/index.html Selects DOM elements for the chat interface and initializes variables. Ensure these elements exist in your HTML. ```javascript const chatBox = document.getElementById('chat-box'); const chatForm = document.getElementById('chat-form'); const userIdInput = document.getElementById('userId'); const questionInput = document.getElementById('question'); const sendBtn = document.getElementById('send-btn'); let historyEventSource = null; ``` -------------------------------- ### Run Project with Docker Offload Source: https://github.com/docker/compose-for-agents/blob/main/adk/README.md Execute this command to run the project using Docker Offload, which allows leveraging a remote GPU for enhanced inference capabilities. This requires specifying both the main compose file and the offload configuration. ```sh docker compose -f compose.yaml -f compose.offload.yaml up --build ``` -------------------------------- ### Run Type Checking with Pyright Source: https://github.com/docker/compose-for-agents/blob/main/adk-sock-shop/CLAUDE.md Execute Pyright for static type checking of the Python code. ```bash pyright ``` -------------------------------- ### Restart Project with OpenAI Configuration Source: https://github.com/docker/compose-for-agents/blob/main/crew-ai/README.md Stop the current Docker Compose services, then restart the project using both the default `compose.yaml` and the `compose.openai.yaml` file to enable OpenAI inference. ```sh docker compose down -v docker compose -f compose.yaml -f compose.openai.yaml up ``` -------------------------------- ### ADK with Cerebras Integration for Go Assistance Source: https://context7.com/docker/compose-for-agents/llms.txt Sets up a multi-agent system using local Docker Model Runner with remote Cerebras API for Go programming assistance. Requires setting CEREBRAS_API_KEY in a .env file. ```yaml # adk-cerebras/compose.yml (partial) services: agents: build: context: agents ports: - 8000:8000 environment: - CEREBRAS_API_KEY=${CEREBRAS_API_KEY} - CEREBRAS_BASE_URL=https://api.cerebras.ai/v1 - CEREBRAS_CHAT_MODEL=llama-4-scout-17b-16e-instruct ``` ```bash # Setup Cerebras API key cp .env.sample .env # Edit .env with your CEREBRAS_API_KEY # Run the demo cd adk-cerebras docker compose up # Open http://localhost:8000 # Try: "Bob generate a golang hello world program" # Then: "Cerebras can you analyse and comment this code" ``` -------------------------------- ### Run All Project Tests Source: https://github.com/docker/compose-for-agents/blob/main/langchaingo/README.md This command runs all tests in the project, utilizing Testcontainers Go to manage necessary Docker containers for testing. ```sh go test -v ./... ``` -------------------------------- ### Set OpenAI API Key Source: https://github.com/docker/compose-for-agents/blob/main/minions/README.md Set your OpenAI API key as an environment variable. Replace 'sk-your-key-here' with your actual key. ```bash export OPENAI_API_KEY=sk-your-key-here ``` -------------------------------- ### Run String Comparison Tests Source: https://github.com/docker/compose-for-agents/blob/main/langchaingo/README.md Execute this specific test to check answer correctness via direct string comparison. Note that this method is less robust due to the non-deterministic nature of LLMs. ```sh go test -v -run TestChat_stringComparison ./... ``` -------------------------------- ### Configure Cerebras API Key Source: https://github.com/docker/compose-for-agents/blob/main/adk-cerebras/README.md Create a .env file to store your Cerebras API key and base URL. Ensure the chat model is correctly specified. ```env CEREBRAS_API_KEY= CEREBRAS_BASE_URL=https://api.cerebras.ai/v1 CEREBRAS_CHAT_MODEL=llama-4-scout-17b-16e-instruct ``` -------------------------------- ### Clone Project Repository Source: https://github.com/docker/compose-for-agents/blob/main/embabel/README.md Clone the Tripper repository to access the necessary configuration files. Navigate into the project directory after cloning. ```sh git clone git@github.com:embabel/tripper.git cd travel-agent-planner ``` -------------------------------- ### Configure MCP Secrets Source: https://github.com/docker/compose-for-agents/blob/main/embabel/README.md Set up API keys for Brave Search and Google Maps using the Docker MCP secret command. Export these secrets to an environment file for use by the application. ```sh docker mcp secret set 'brave.api_key=' docker mcp secret set 'google-maps.api_key=' docker mcp secret export brave google-maps github > .mcp.env ``` -------------------------------- ### Format and Lint Code with Ruff Source: https://github.com/docker/compose-for-agents/blob/main/adk-sock-shop/CLAUDE.md Use Ruff for code formatting and linting to maintain code quality and consistency. ```bash ruff check ``` ```bash ruff format ``` -------------------------------- ### Run RAG Tests Source: https://github.com/docker/compose-for-agents/blob/main/langchaingo/README.md Execute this test to evaluate answers using the Retrieval-Augmented Generation (RAG) technique. It involves setting up a Weaviate store and using it to retrieve relevant documents for the LLM prompt. ```sh go test -v -run TestChat_rag ./... ``` -------------------------------- ### LangGraph SQL Agent Implementation Source: https://context7.com/docker/compose-for-agents/llms.txt Python code for an AI agent that generates and executes SQL queries against a PostgreSQL database. It requires initialization of a chat model and uses LangGraph's create_react_agent for agent creation. The agent interacts with a SQL database via an MCP session. ```python # langgraph/agent.py from langchain.chat_models import init_chat_model from langchain_mcp_adapters.tools import load_mcp_tools from langgraph.prebuilt import create_react_agent from mcp import ClientSession from mcp.client.sse import sse_client system_prompt = """ You are an agent designed to interact with a SQL database. Given an input question, create a syntactically correct {dialect} query to run, then look at the results of the query and return the answer. You MUST double check your query before executing it. If you get an error while executing a query, rewrite the query and try again. DO NOT make any DML statements (INSERT, UPDATE, DELETE, DROP etc.) to the database. """ async def main(): llm = init_chat_model(model, model_provider="openai", api_key=api_key, base_url=base_url) async with sse_client(url=mcp_server_url, timeout=60) as (read, write): async with ClientSession(read, write) as session: await session.initialize() tools = await load_mcp_tools(session) agent = create_react_agent(llm, tools=tools, prompt=system_prompt) async for step in agent.astream( {"messages": [{"role": "user", "content": question}]} stream_mode="values", ): step["messages"][-1].pretty_print() asyncio.run(main()) ``` -------------------------------- ### A2A Fact Checker Docker Compose Configuration Source: https://context7.com/docker/compose-for-agents/llms.txt Sets up Docker Compose for the A2A fact-checker demo, defining services for auditor, critic agents, and the MCP gateway. Includes port mappings, environment variables, and secrets for API keys. ```yaml # a2a/compose.yaml services: auditor-agent-a2a: build: target: auditor-agent ports: - 8080:8080 environment: - CRITIC_AGENT_URL=http://critic-agent-a2a:8001 - REVISER_AGENT_URL=http://reviser-agent-a2a:8001 - OPENAI_MODEL_NAME=o3 secrets: - openai-api-key critic-agent-a2a: build: target: critic-agent environment: - MCPGATEWAY_ENDPOINT=http://mcp-gateway:8811/sse depends_on: - mcp-gateway mcp-gateway: image: docker/mcp-gateway:latest use_api_socket: true command: - --transport=sse - --servers=duckduckgo secrets: openai-api-key: file: secret.openai-api-key ``` -------------------------------- ### Store OpenAI API Key Source: https://github.com/docker/compose-for-agents/blob/main/akka/README.md Create a file named 'secret.openai-api-key' and place your OpenAI API key inside it. This file is used to authenticate with the OpenAI service. ```plaintext sk-... ``` -------------------------------- ### Create Feature Branch Source: https://github.com/docker/compose-for-agents/blob/main/agno/agent-ui/CONTRIBUTING.md Use this command to create a new branch for your feature development. ```git git checkout -b feature/amazing-feature ``` -------------------------------- ### Commit Changes Source: https://github.com/docker/compose-for-agents/blob/main/agno/agent-ui/CONTRIBUTING.md Stage and commit your code changes with a descriptive message. ```git git commit -m 'Add some amazing feature' ``` -------------------------------- ### Navigate Back to DevDuck Agent Source: https://github.com/docker/compose-for-agents/blob/main/adk-cerebras/README.md If you encounter issues returning from the Cerebras agent, use this command to reset the context and return to the main DevDuck agent. ```text go back to devduck ``` -------------------------------- ### Run Cosine Similarity Tests Source: https://github.com/docker/compose-for-agents/blob/main/langchaingo/README.md Run this test for a more robust answer evaluation using cosine similarity between reference and model-generated answer embeddings. The test passes if the similarity exceeds a defined threshold. ```sh go test -v -run TestChat_embeddings ./... ``` -------------------------------- ### Handle Question Input Keydown Source: https://github.com/docker/compose-for-agents/blob/main/akka/src/main/resources/static-resources/index.html Attaches a keydown event listener to the question input field. If the 'Enter' key is pressed without the 'Shift' key, it prevents the default behavior and simulates a click on the send button. ```javascript questionInput.addEventListener('keydown', function(e) { if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); sendBtn.click(); } }); ``` -------------------------------- ### Configure MCP Secrets for GitHub Token Source: https://github.com/docker/compose-for-agents/blob/main/agno/README.md Add your GitHub token to the .mcp.env file for MCP server authentication. This is required for the GitHub Issue Retriever agent to access repositories. ```sh github.personal_access_token=ghp_XXXXX ``` -------------------------------- ### Stop and Remove Docker Containers Source: https://github.com/docker/compose-for-agents/blob/main/minions/README.md Use this command to stop and remove all containers, networks, and volumes defined in the Docker Compose file. Ensure you are in the correct directory before executing. ```bash cd minions/apps/minions-docker docker compose -f docker-compose.minions.yml down -v ``` -------------------------------- ### Set MCP Secret Source: https://github.com/docker/compose-for-agents/blob/main/vercel/README.md Configure a secret for an MCP, such as the Brave Search API key. Ensure you replace the placeholder with your actual API key. ```bash docker mcp secret set 'brave.api_key=' ``` -------------------------------- ### Handle Chat Form Submission Source: https://github.com/docker/compose-for-agents/blob/main/akka/src/main/resources/static-resources/index.html Handles the submission of the chat form. It sends the user's question to the server, displays the user's message, and then streams the bot's response. Includes error handling for the fetch request and response processing. ```javascript chatForm.addEventListener('submit', async function(e) { e.preventDefault(); const userId = userIdInput.value.trim(); const question = questionInput.value.trim(); if (!userId || !question) return; appendMessage(question, 'user'); sendBtn.disabled = true; try { const response = await fetch('/chat/ask', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ userId, question }) }); const bubble = appendMessageStreamStart(); if (!response.ok) { appendMessageStream("[Error] Failed to get response from server.", bubble); sendBtn.disabled = false; return; } const reader = response.body.getReader(); const decoder = new TextDecoder(); let buffer = ''; let botParts = []; while (true) { const { done, value } = await reader.read(); if (done) break; buffer += decoder.decode(value, { stream: true }); let parts = buffer.split('\n'); buffer = parts.pop(); for (let part of parts) { if (part.startsWith('data:')) { let data = part.substring(5).trimStart(); data = cleanBotData(data); botParts.push(data); appendMessageStream(data, bubble); } } } if (botParts.length > 0) { addRecentMessage(normalizeTextForComparison(botParts.join('
')),'bot'); } } catch (err) { appendMessage(`[Error] ${err.message}`, 'bot'); } finally { sendBtn.disabled = false; questionInput.value = ''; questionInput.focus(); } }); ``` -------------------------------- ### Common MCP Gateway Configuration Source: https://context7.com/docker/compose-for-agents/llms.txt Configure the MCP Gateway for secure access to MCP servers. Specify transport, enabled servers, exposed tools, and secrets for authentication. ```yaml mcp-gateway: image: docker/mcp-gateway:latest use_api_socket: true command: - --transport=sse # or streaming - --servers=duckduckgo # MCP servers to enable - --tools=search,fetch_content # Specific tools to expose - --secrets=docker-desktop:/run/secrets/mcp_secret # For authenticated servers - --interceptor # Optional: add response interceptors - after:exec:echo RESPONSE=$(cat) >&2 # Mount secrets for MCP servers requiring authentication secrets: mcp_secret: file: ./.mcp.env ``` -------------------------------- ### Set MCP Secret and Export Environment Variables Source: https://github.com/docker/compose-for-agents/blob/main/agno/README.md Alternatively, set the MCP secret directly using the docker mcp command and export it to a .mcp.env file if running with Docker Offload. ```sh touch .mcp.env docker mcp secret set 'github.personal_access_token=ghp_XXXXX' # only needed if running with Docker Offload docker mcp secret export > .mcp.env ``` -------------------------------- ### Academic Citation for Minions Source: https://github.com/docker/compose-for-agents/blob/main/minions/README.md This is the BibTeX entry for the Minions research paper. Include this in your academic work when citing the Minions project. ```bibtex @article{narayan2025minions, title={Minions: Cost-efficient Collaboration Between On-device and Cloud Language Models}, author={Narayan, Avanika and Biderman, Dan and Eyuboglu, Sabri and May, Avner and Linderman, Scott and Zou, James and R{\'e}, Christopher}, journal={arXiv preprint arXiv:2502.15964}, year={2025} } ``` -------------------------------- ### Normalize Text for Comparison Source: https://github.com/docker/compose-for-agents/blob/main/akka/src/main/resources/static-resources/index.html Prepares text for comparison by removing HTML tags, decoding entities, removing Markdown formatting, and collapsing whitespace. This function is crucial for duplicate message detection. ```javascript function normalizeTextForComparison(text) { // Remove HTML tags except
let normalized = text.replace(/<[^>]+>/g, ''); // Remove
tags (case-insensitive) normalized = normalized.replace(//gi, ''); // Decode HTML entities const txt = document.createElement('textarea'); txt.innerHTML = normalized; normalized = txt.value; // Remove Markdown bold/italic/code normalized = normalized.replace(/[\[\*\_\`~\ \\]+/g, ''); // Remove all whitespace characters (spaces, tabs, newlines, etc.) normalized = normalized.replace(/\s+/g, ''); // Trim (just in case) return normalized.trim().toLowerCase(); } ``` -------------------------------- ### Akka Chatbot CSS Styling Source: https://github.com/docker/compose-for-agents/blob/main/akka/src/main/resources/static-resources/index.html Provides CSS rules for styling the Akka Chatbot interface, including the chat box, messages, bubbles, and input elements. Ensure these styles are included in your project's stylesheet. ```css #chat-box { width: 100%; height: 300px; background-color: #111; color: #fff; border: 1px solid #aaa; border-radius: 4px; font-family: "Instrument Sans", sans-serif; padding: 16px; margin-bottom: 16px; overflow-y: auto; font-size: 1.05rem; box-sizing: border-box; } .chat-message { margin-bottom: 24px; line-height: 1.5; word-break: break-word; display: flex; } .chat-message.user { justify-content: flex-end; } .chat-message.bot { justify-content: flex-start; } .bubble { max-width: 70%; padding: 10px 18px; border-radius: 18px; font-weight: 500; font-size: 1.05rem; box-shadow: 0 2px 8px rgba(0,0,0,0.08); } .bubble.user-bubble { background: linear-gradient(90deg, #00dbdd 80%, #ffce4a 100%); color: #000; border-bottom-right-radius: 4px; border-bottom-left-radius: 18px; border-top-left-radius: 18px; border-top-right-radius: 18px; margin-left: 40px; font-weight: 600; } .bubble.bot-bubble { background: #222; color: #ffce4a; border-bottom-left-radius: 4px; border-bottom-right-radius: 18px; border-top-left-radius: 18px; border-top-right-radius: 18px; margin-right: 40px; font-weight: 500; } .chat-label { color: #aaa; font-size: 1rem; margin-bottom: 8px; } .hostname-row { display: flex; justify-content: center; margin-top: 30px; margin-bottom: 0; } .hostname-span { font-size: 2.2rem; font-weight: 700; color: #00dbdd; /* Button blue */ letter-spacing: -0.01562em; font-family: "Instrument Sans", sans-serif; text-align: center; } .chat-title { color: #ffce4a; font-size: 2.2rem; font-weight: 700; letter-spacing: -0.01562em; text-align: center; margin: 0 0 30px 0; } .form-section { max-width: 600px; margin: 0 auto; } .question-group { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; } #question { flex: 1; } #send-btn { align-self: flex-start; background: linear-gradient(90deg, #00dbdd 80%, #ffce4a 100%); color: #000; font-weight: 700; border: none; border-radius: 6px; padding: 8px 20px; font-size: 1rem; cursor: pointer; transition: background 0.2s; } #send-btn:hover { background: linear-gradient(90deg, #00b3b3 80%, #ffd700 100%); } ``` -------------------------------- ### Run Evaluator Tests Source: https://github.com/docker/compose-for-agents/blob/main/langchaingo/README.md Run this test to evaluate answer accuracy using an LLM as a judge. The evaluator LLM assesses the provided answer and returns a JSON object indicating correctness and reasoning. ```sh go test -v -run TestChat_usingEvaluator ./... ``` -------------------------------- ### Load Chat History via SSE Source: https://github.com/docker/compose-for-agents/blob/main/akka/src/main/resources/static-resources/index.html Loads chat history for a given user ID using Server-Sent Events (SSE). It parses incoming JSON data and appends messages to the chat box. Ensure EventSource is supported in the browser. ```javascript function loadChatHistorySSE(userId) { if (!userId) return; clearChatBox(); if (historyEventSource) { historyEventSource.close(); historyEventSource = null; } const url = `/${encodeURIComponent(userId)}/history-stream`; historyEventSource = new EventSource(url); historyEventSource.onmessage = function(event) { if (!event.data || event.data.trim() === "") { return; } try { const dialog = JSON.parse(event.data); if (!dialog || !dialog.text) return; const sender = dialog.dialogSource === "USER" ? "user" : "bot"; appendMessage(extractQuestion(dialog).text, sender); } catch (err) { // Ignore parse errors } }; historyEventSource.onerror = function() { if (historyEventSource) { historyEventSource.close(); historyEventSource = null; } }; } ``` -------------------------------- ### Handle User ID Input Change Source: https://github.com/docker/compose-for-agents/blob/main/akka/src/main/resources/static-resources/index.html Attaches an event listener to a user ID input field. When the input value changes, it triggers the loading of chat history for the specified user ID. ```javascript userIdInput.addEventListener('change', function() { const userId = userIdInput.value.trim(); loadChatHistorySSE(userId); }); ```