@@ -10,7 +10,7 @@ of this context data grows, agent processing times typically also increase.
1010More and more data is sent to the generative AI model used by the agent,
1111increasing processing time and slowing down responses. The ADK Context
1212Compaction feature is designed to reduce the size of context as an agent
13- is running by summarizing older parts of the agent workflow event history.
13+ is running by summarizing older parts of the agent workflow event history.
1414
1515The Context Compaction feature uses a * sliding window* approach for collecting
1616and summarizing agent workflow event data within a
@@ -47,7 +47,7 @@ background each time the session reaches the interval.
4747If you set ` compaction_interval ` to 3 and ` overlap_size ` to 1, the event data is
4848compressed upon completion of events 3, 6, 9, and so on. The overlap setting
4949increases size of the second summary compression, and each summary afterwards,
50- as shown in Figure 1.
50+ as shown in Figure 1.
5151
5252![ Context compaction example illustration] ( /adk-docs/assets/context-compaction.svg )
5353** Figure 1.** Ilustration of event compaction configuration with a interval of 3
@@ -65,19 +65,19 @@ With this example configuration, the context compression tasks happen as follows
6565
6666The configuration settings for this feature control how frequently event data is compressed
6767and how much data is retained as the agent workflow runs. Optionally, you can configure
68- a compactor object
68+ a compactor object
6969
7070* ** ` compaction_interval ` ** : Set the number of completed events that triggers compaction
71- of the prior event data.
71+ of the prior event data.
7272* ** ` overlap_size ` ** : Set how many of the previously compacted events are included in a
7373 newly compacted context set.
74- * ** ` compactor ` ** : (Optional) Define a compactor object including a specific AI model
75- to use for summarization. For more information, see
76- [ Define a compactor ] ( #define-compactor ) .
74+ * ** ` summarizer ` ** : (Optional) Define a summarizer object including a specific AI model
75+ to use for summarization. For more information, see
76+ [ Define a Summarizer ] ( #define-summarizer ) .
7777
7878### Define a Summarizer {#define-summarizer}
79- You can customize the process of context compression by defining a summarizer.
80- The LlmEventSummarizer class allows you to specify a particular model for summarization.
79+ You can customize the process of context compression by defining a summarizer.
80+ The LlmEventSummarizer class allows you to specify a particular model for summarization.
8181The following code example demonstrates how to define and configure a custom summarizer:
8282
8383``` python
@@ -96,12 +96,12 @@ app = App(
9696 name = ' my-agent' ,
9797 root_agent = root_agent,
9898 events_compaction_config = EventsCompactionConfig(
99- summarizer = my_summarizer,
10099 compaction_interval = 3 ,
101- overlap_size = 1
100+ overlap_size = 1 ,
101+ summarizer = my_summarizer,
102102 ),
103103)
104- ```
104+ ```
105105
106106You can further refine the operation of the ` SlidingWindowCompactor ` by
107107by modifying its summarizer class ` LlmEventSummarizer ` including changing
0 commit comments