docker-agent Examples

May 7, 2026 · View on GitHub

This directory is a curated catalog of working agent configurations. Each example demonstrates one or more features of docker-agent and is meant to be read as documentation as well as run as-is.

Running an example

Most files have a shebang line and are directly executable, but the canonical way to run any of them is:

$ docker agent run examples/<name>.yaml

Add -c <command> to invoke one of the agent's commands, --exec to skip the TUI, or -a <agent> to run a specific agent from a multi-agent file. A handful of examples (e.g. tic-tac-toe.yaml, elicitation/, eval/) ship a small README of their own with extra setup instructions — read those before running.

Most agents need API keys for at least one provider (OpenAI, Anthropic, Google, Mistral, Nebius, Groq, GitHub Models, Bedrock, …). Set the matching environment variable (OPENAI_API_KEY, ANTHROPIC_API_KEY, …) before running, or wire the agent to a key your gateway/proxy already holds.

The rest of this document groups examples by what feature they showcase. If you are looking for inspiration to build a real agent, jump to Real-world agents.


Getting started — minimal agents

The smallest possible configurations. Read these first to learn the YAML shape: an agents.root block with at least a model, a description, and an instruction.

FileWhat it shows
basic_agent.yamlThe bare minimum: model + instruction, no tools.
echo-agent.yamlSame shape with an explicit models: block and zero temperature.
pirate.yaml / pirate.hclPersona-only agent in YAML and the equivalent HCL form.
haiku.yamlWrites haikus.
42.yamlDouglas-Adams-style witty assistant.
contradict.yamlContrarian.
silvia.yamlSylvia-Plath-inspired poet.
mistral.yamlTiny agent pinned to a Mistral model.
pokemon.yamlFrench-speaking Pokémon expert with two trainer sub-agents.
alloy.yamlLearning assistant.
dmr.yamlPirate served by a local Docker Model Runner endpoint.
welcome_message.yamlAdds a welcome_message shown by the TUI.
instructions_from_file.hcl + instructions_from_file.mdLoads the system instruction from an external file via ${file(...)}.
gopher.yaml / gopher.hclSame agent in YAML and HCL.

Built-in toolsets

Examples that wire up one of the toolsets shipped with docker-agent (filesystem, shell, todo, think, memory, fetch, script, user_prompt, api, openapi, rag, model_picker, …).

Filesystem & shell

FileWhat it shows
shell.yamlPlain shell toolset.
filesystem.yamlPlain filesystem toolset.
filesystem_allow_deny.yamlRestricting the filesystem tool with allow/deny path lists.
script_shell.yamlDefining custom shell commands as named tools via type: script.
pythonista.yamlPython tutor with filesystem + shell.
diag.yamlLog analysis using filesystem + shell + think.
typo.yamlRestricts a filesystem toolset to a subset of tools and exposes them as a fix command.
toolset-working-dir.yamlSetting a working_dir for MCP/LSP toolsets.
post_edit.yamlAuto-runs gofmt -w on every .go file the agent edits via filesystem.post_edit.
sandbox_agent.yamlSame shell-based agent run with --sandbox to confine commands to a Docker container.
deferred.yamlWraps the agent in a deferred-execution container (runtime: deferred).

Memory, todo, think, cache

FileWhat it shows
mem.yamlPersistent memory via the memory toolset (SQLite-backed).
todo.yamlTask manager built on the todo toolset.
shared-todo.yamlMultiple agents sharing the same todo list.
cached_responses.yamlCaching final answers in JSON so repeated questions don't hit the model.

Web & API access

FileWhat it shows
fetch_docker.yamlUses the built-in fetch toolset to summarize a web page.
fetch_headers.yamlAdding custom HTTP headers (e.g. Authorization) to fetch.
fetch_domain_filtering.yamlRestricting fetch to an allow-list of domains.
api-tool.yamlDefines a single REST endpoint as a typed tool via type: api.
openapi-petstore.yamlGenerates one tool per endpoint from a public OpenAPI spec.
bio.yamlBiographer driven by DuckDuckGo + fetch.
search.yamlWeb research powered by Brave + fetch.
librarian.yamlDocumentation researcher using context7 + DuckDuckGo + fetch.

RAG (Retrieval-Augmented Generation)

FileWhat it shows
rag.yamlEnd-to-end example with a chunked-embeddings index over local docs.
rag/bm25.yamlLexical BM25 strategy.
rag/semantic_embeddings.yamlPure semantic-embeddings strategy.
rag/hybrid.yamlHybrid BM25 + embeddings retrieval.
rag/reranking.yamlHybrid retrieval with a re-ranking model on top.
rag/custom_provider.yamlPointing the embeddings model at a custom OpenAI-compatible provider.

MCP — Model Context Protocol

docker-agent speaks MCP natively. These examples cover everything from referencing a single Docker MCP server to wiring up the full MCP Toolkit and remote MCP endpoints.

Local & catalog MCP servers

FileWhat it shows
apify.yamlSingle MCP server (docker:apify).
airbnb.yamlAirbnb search via the openbnb MCP server.
moby.yamlProject expert backed by gitmcp.io/moby/moby.
couchbase_agent.yamlDatabase commands through the Couchbase MCP server.
github.yamlGitHub assistance via docker:github-official.
github_issue_manager.yamlSame MCP, scoped to issue-management tools.
github-toon.yamlGitHub MCP with the TOON compact tool format.
mcp_generator.yamlResearches and emits new MCP server configurations.
k8s_debugger.yamlKubernetes triage with the Inspektor-Gadget + kubernetes MCP servers.
mcp-toolkit.yamlDiscovering and enabling servers from the Docker MCP Toolkit.
mcp-definitions.yamlTop-level mcps: block: define a server once, reference it from many agents.
podcastgenerator_githubmodel.yamlMulti-agent podcast pipeline using GitHub Models + DuckDuckGo + filesystem MCPs.
dhi/dhi.yamlMigrates Dockerfiles to Docker Hardened Images.

Remote MCP & transports

FileWhat it shows
notion-expert.yamlRemote MCP server with OAuth Dynamic Client Registration.
remote_mcp_oauth.yamlRemote MCP server with explicit OAuth credentials (Slack/GitHub-style).
remote_mcp_oauth_callback_redirect.yamlOAuth flow with a public redirect URL bouncing back to localhost.
websocket_transport.yamlOpenAI Responses API streaming over WebSocket instead of SSE.
ha.yamlHome Assistant via remote MCP (streamable HTTP).
elicitation/Demo MCP server that asks the user for structured input mid-call (forms, confirmations, enums).

Multi-agent setups

Coordinator + sub-agents (in-process)

FileWhat it shows
blog.yamlTechnical blog pipeline (researcher → writer → reviewer).
writer.yamlStory writing supervisor with specialized sub-agents.
finance.yamlFinancial research orchestrating analysts.
background_agents.yamlParallel research delegated to background sub-agents.
dev-team.yamlProduct-manager-led team (designer + engineer) with shared memory.
multi-code.yamlTech-lead routing tasks to a frontend and a Go expert.
coder.yamlCoding agent with planner, implementer, and librarian sub-agents.
pr-reviewer-bedrock.yamlPR review toolkit pinned to Bedrock models.
professional/professional_writing_agent.yamlEnglish editor + French translator team.
handoff.yamlStrict handoff (type: handoff) between specialists.

Catalog sub-agents

FileWhat it shows
sub-agents-from-catalog.yamlMixes locally-defined sub-agents with ones pulled from an OCI catalog (e.g. agentcatalog/pirate).

Inter-agent protocols (A2A & MCP)

FileWhat it shows
tic-tac-toe.yamlGame-master + two players communicating over A2A.
tic-tac-toe-mcp.yamlSame demo, players exposed as MCP servers instead.

Models, providers & routing

FileWhat it shows
custom_provider.yamlTalking to any OpenAI-compatible endpoint via a custom provider.
compose-secrets.yamlReading API keys from Docker Compose / Swarm secrets.
env_placeholders.yaml${ENV_VAR} substitution inside the YAML.
nebius.yamlNebius cloud provider.
grok.yamlxAI Grok model.
github-copilot.yamlGitHub Copilot models via OAuth device-flow.
fallback_models.yamlAutomatic fallback to a secondary model when the primary fails.
model_picker.yamlLets the agent itself swap to a stronger model mid-conversation.
per_tool_model_routing.yamlUse a cheap/fast model to interpret tool results, the primary model for reasoning.
rule_based_routing.yamlCheap router model dispatches the user message to fast or capable models.
structured-output.yamlForces the model to return JSON matching a schema.
google_search_grounding.yamlEnables Google Search grounding on Gemini models.
sampling-opts.yamlProvider-specific sampling parameters (top_k, repetition_penalty, …).
thinking_budget.yamlReasoning/thinking budgets across OpenAI, Anthropic and Google.
task_budget.yamlAnthropic task_budget: cap total tokens spent across a multi-step agentic task.

Permissions, redaction & sandboxing

FileWhat it shows
permissions.yamlTop-level permissions block with allow/deny patterns for tool calls.
llm_judge.yamlLayered defense: deterministic permissions + an LLM-as-judge pre_tool_use hook + user prompts.
redact_secrets.yamlSingle-flag (redact_secrets: true) scrubbing of detected secrets in args, chat content, and tool output.
redact_secrets_hooks.yamlThe same scrubbing wired manually as three hooks.
sandbox_agent.yamlRunning tools inside a Docker sandbox via docker agent run --sandbox.
filesystem_allow_deny.yamlPath-level allow/deny for the filesystem toolset.

Hooks & toolset lifecycle

FileWhat it shows
hooks.yamlComprehensive tour of every hook event (pre_tool_use, post_tool_use, before_llm_call, after_llm_call, transform, notification, session_*, …).
unload_on_switch.yamlon_agent_switch builtin (command: unload) that unloads the previous agent's models (DMR _unload) so two heavy local models can share a single GPU.
lifecycle.yamlPer-toolset lifecycle policies (strict, resilient, best-effort) and restart/back-off tuning.
post_edit.yamlFilesystem post_edit actions running after every file edit.

Code-mode, skills & runtime knobs

FileWhat it shows
code_mode.yamlcode_mode_tools: true lets the model script multi-step tool calls in code instead of one-shot calls.
skills_filter.yamlRestricts which discovered skills the agent is allowed to expose.
toolset_instructions.yamlAugmenting a toolset's default instructions with {ORIGINAL_INSTRUCTIONS}.

Real-world agents

Larger, opinionated agents you can use as starting points for your own projects.

FileWhat it does
code.yamlCode analysis + modification + validation loop.
coder.yamlCoding agent with planner and librarian sub-agents.
multi-code.yamlTech-lead routing between web and Go specialists.
gopher.yaml / gopher.hclGo-specialist coding agent.
go_packages.yamlExpert in the Go module ecosystem.
modernize-go-tests.yamlMass-modernizes Go test suites to recent Go idioms.
pr-reviewer-bedrock.yamlPR reviewer pinned to Bedrock.
review.yamlDockerfile review specialist.
doc_generator.yamlGenerates documentation from a codebase.
image_text_extractor.yamlOCR-ish extractor for text in images.
dhi/dhi.yamlMigrates Dockerfiles to Docker Hardened Images.
k8s_debugger.yamlKubernetes incident triage.

Evaluation

FileWhat it shows
eval/Saved sessions plus the agent under test, runnable with docker agent eval demo.yaml ./evals.

Embedding docker-agent in Go programs

Code samples that import the docker-agent Go packages directly.

PathWhat it shows
golibrary/simple/Single agent, single message.
golibrary/multi/Two agents with a transfer_task hand-off.
golibrary/tool/Registering a custom Go-defined tool.
golibrary/builtintool/Wiring up a built-in toolset (shell) from Go.
golibrary/stream/Consuming the runtime's streaming events (RunStream).
chat/Tiny OpenAI-SDK client that talks to docker agent serve chat — proves any OpenAI-compatible client works against a docker-agent.

Conventions

  • YAML is the recommended format. HCL is also supported (*.hcl); the pirate.{yaml,hcl}, gopher.{yaml,hcl} and instructions_from_file.hcl pairs show equivalent agents in both formats.
  • Every example references the JSON schema at agent-schema.json — point your editor at it for autocomplete and validation.
  • Examples target the latest schema version. Older config versions live under pkg/config/v0, v1, … and are intentionally frozen; new features only land on the latest version.