Koog 1.0 idioms, gotchas, and scaffolding skills for Kotlin agents on the JVM
88
88%
Does it follow best practices?
Impact
88%
1.95xAverage score across 43 eval scenarios
Passed
No known issues
This skill is an action router — pick the step that matches the user's intent and execute only that step. Do not run other steps; do not parallelize.
Available actions:
systemPrompt (default — when a one-paragraph instruction is enough)prompt { ... } builder with few-shot examples and structured turnsPromptAugmentersystemPromptIf the user just wants to set an instruction string, the factory's systemPrompt parameter is the right surface. No DSL needed:
val agent = AIAgent(
promptExecutor = ...,
llmModel = ...,
systemPrompt = """
You are a GitHub triage assistant. Classify issues, suggest labels,
and link related issues by number when relevant.
""".trimIndent(),
)If the user is reaching for more structure than a single string supports, escalate to Step 2.
Finish here.
prompt { ... } BuilderUse the DSL when you need system + assistant + user turns interleaved (few-shot examples), or when the same prompt shape is reused across multiple agents.
import ai.koog.prompt.dsl.prompt
val triagePrompt = prompt("issue-triage") {
system("You are a GitHub triage assistant. Classify issues as bug, feature, or question.")
// Few-shot example 1
user("App crashes on Windows when I open the Settings dialog.")
assistant("""{"classification": "bug", "confidence": 0.95}""")
// Few-shot example 2
user("Could we add dark mode to the export view?")
assistant("""{"classification": "feature", "confidence": 0.9}""")
// The actual turn is appended at runtime by the agent
}The Prompt class lives in ai.koog.prompt.Prompt as of 1.0 (moved from ai.koog.prompt.dsl.Prompt, #2022); the prompt { ... } builder DSL stays in ai.koog.prompt.dsl.
Pass the built Prompt into the agent's strategy or context — the exact wiring point depends on whether the prompt is the agent's system prompt or a per-node call. For per-node use inside a strategy, send the prompt through llm.writeSession { appendPrompt { ... } }.
Finish here.
PromptAugmenterWhen the prompt needs runtime data (user metadata, current time, retrieved facts), use the augmenter family rather than string-templating into a systemPrompt. The augmenter appends a MessagePart to an existing Message — message-level rewrites from earlier versions are gone.
Variants:
SystemPromptAugmenter — append to the system messageUserPromptAugmenter — append to the next user turnAgentcorePromptAugmenter — append for Bedrock AgentCore flowsimport ai.koog.prompt.processor.SystemPromptAugmenter
class TimestampAugmenter : SystemPromptAugmenter {
override fun augment(): MessagePart {
return MessagePart.text("Current time is ${java.time.Instant.now()}.")
}
}
// Install via the agent's prompt processor surface (see prompt-processor module)Augmenters run on every agent invocation — keep them cheap. Heavy fact retrieval belongs in LongTermMemory's search pipeline (see manage-state), not in an augmenter.
Finish here.
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
scenario-11
scenario-12
scenario-13
scenario-14
scenario-15
scenario-16
scenario-17
scenario-18
scenario-19
scenario-20
scenario-21
scenario-22
scenario-23
scenario-24
scenario-25
scenario-26
scenario-27
scenario-28
scenario-29
scenario-30
scenario-31
scenario-32
scenario-33
scenario-34
scenario-35
scenario-36
scenario-37
scenario-38
scenario-39
scenario-40
scenario-41
scenario-42
scenario-43
skills
add-observability
add-persistence
add-rag
add-structured-output
add-token-budgeting
add-tool
cache-llm-calls
define-prompt
domain-model-subtask-pipeline
references
enable-prompt-caching
handle-agent-events
manage-state
migrate-from-0-x
model-planner-subtasks
persist-chat-history
query-sql-from-agent
scaffold-agent
snapshot-and-restore
test-koog-agents
trace-agent-internals
use-attachments
use-functional-agent
use-llm-node-variants
use-planner
wire-a2a
wire-acp-server
wire-ktor-server
wire-mcp-server
wire-spring-boot