Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add agents/jetbrains/koog/graph-based-agentsgit clone --depth 1 https://github.com/JetBrains/koogWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.07137 |
| Opus 5 | $0.00000 | $0.03569 |
| Sonnet 5 | $0.00000 | $0.01427 |
| Haiku 4.5 | $0.00000 | $0.00714 |
Grade C, and why
graph-based-agents scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Hidden instructionshighPrompt injection
Directives inside HTML comments, invisible characters or bidirectional overrides are read by the model and not by the person reviewing the file.
<!--- INCLUDE import ai.koog.agents.core.agent.AIAgent; import ai.koog.agents.core.agent.entity.AIAgentEdge; import ai.koog.agents.core.agent.entity.AIAgentGraphStrategy; import ai.koog.agents.core.agent.entity.AIAgentNo This is a copy
89% identical to basic-agents — 986 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 804 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Graph-based agents
With graph-based agents, you model the behavior as an explicit state machine: nodes of a graph strategy represent actions (LLM calls, tool execution) and edges represent data flow between nodes.
The main advantages of graph-based agents are:
- Easy to visualize
- State persistence
- Composable architecture
??? note "Prerequisites"
--8<-- "quickstart-snippets.md:prerequisites"
--8<-- "quickstart-snippets.md:dependencies"
--8<-- "quickstart-snippets.md:api-key"
Examples on this page assume that you are running Llama 3.2 locally via Ollama.
This page describes how to re-create the strategy graph used by basic agents. It sends a request to an LLM and then either outputs the response (if the LLM responded with an assistant message) or executes a tool (if the LLM requested a tool call). In case of a tool call, the agent sends the tool result to the LLM and then either outputs the response or executes a tool.
Here is an illustration of the strategy graph:
---
config:
flowchart:
defaultRenderer: "elk"
---
graph TB
subgraph nodeStart
Input
end
subgraph nodeFinish
Output
end
subgraph nodeSendInput
llmRequest(Request LLM)
end
subgraph nodeExecuteTool
executeTool(Execute tool call)
end
subgraph nodeSendToolResult
sendToolResult(Request LLM)
end
Input --String--> llmRequest
llmRequest --Message.Assistant--> onToolCalls{{onToolCalls}}
llmRequest --Message.Assistant--> onTextMessage{{onTextMessage}}
onTextMessage --String--> Output
onToolCalls --ToolCalls--> executeTool --ReceivedToolResults--> sendToolResult
sendToolResult --Message.Assistant--> onToolCalls
sendToolResult --Message.Assistant--> onTextMessage
Build a strategy graph
In Koog, you implement a strategy using AIAgentGraphStrategyBuilder.
Just like every node has an input and output type,
the strategy as a whole also defines some input and output type.
This example assumes that the input and output types are strings,
which means the agent implementing this strategy will expect a string and return a string.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago First seen · 804 lines · 0 tokens per session scan C 55b5087221f9
graph-based-agents is an agent published in the GitHub repository JetBrains/koog (4,553 stars, last pushed today), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 7,137 tokens. A static security scan graded it C with 1 finding (hidden instructions). It is 89% identical to basic-agents, differing in 986 lines, and is treated as a copy.
Other agents, from other repositories
agent-orchestration-context-manager
Elite AI context engineering specialist mastering dynamic context management, vector databases, knowledge graphs, and intelligent memory systems. Orchestrates context across multi-agent workflows, enterprise AI systems, and long-running projects with 2024/2025 best practices. Use PROACTIVELY for complex AI…
backend-development-tdd-orchestrator
Master TDD orchestrator specializing in red-green-refactor discipline, multi-agent workflow coordination, and comprehensive test-driven development practices. Enforces TDD best practices across teams with AI-assisted testing and modern frameworks. Use PROACTIVELY for TDD implementation and governance.
team-lead
Team orchestrator that decomposes work into parallel tasks with file ownership boundaries, manages team lifecycle, and synthesizes results. Use when coordinating multi-agent teams, decomposing complex tasks, or managing parallel workstreams.
team-implementer
Parallel feature builder that implements components within strict file ownership boundaries, coordinating at integration points via messaging. Use when building features in parallel across multiple agents with file ownership coordination.
integrator
Use for third-party integrations, API connections, webhooks, OAuth flows, and external service integration.
lead
Use when coordinating multi-agent teams. Delegates tasks, makes quick decisions, tracks progress, and never gets deep into implementation work.