Reading the docs on subgraphs, it says "Subgraphs ...
# koog-agentic-framework
g
Reading the docs on subgraphs, it says "Subgraphs are sections of the strategy graph that operate with their own set of tools and context." What is meant by "context"? Does it still have access to the history messages from the strategy?
v
Yes — all subgraphs and nodes share the same message history
In Koog you usually would only think of requests and responses with a single pair of input/output — and the framework would append them to the end of the message history so that each step would have everything that happened before as a context. Though, you can have a direct access to it: llm.readSession { println(prompt.messages) } inside a node/subgraph would get a read access to it. llm.writeSession { prompt = …. } inside a node/subgraph would update the whole prompt (list of messages, params, etc.)
g
Thanks for the explanation! Quick follow up, what is the context that is specific to the subgraph? Is it only the tools?
v
You can organise it as you want if you use
subgraph { … }
(even the message history — that you can save, then completely change, then restore back before exiting the subgraph). Though, with higher level components such as
subgraphWithTask
you can normally specify different subset of tools, model, task (main goal of the step) and desired input/output types
thank you color 1