@@ -217,6 +217,52 @@ Then, add your custom interceptor to the pipeline:
217217$generator = $generator->withInterceptor(new ContextAwarePromptInjector(...));
218218```
219219
220+ Check out this UML sequence diagram to see how the prompt generation process works with the interceptors:
221+
222+ ``` mermaid
223+ sequenceDiagram
224+ participant AE as AgentExecutor
225+ participant PGP as PromptGeneratorPipeline
226+ participant IG as InstructionGenerator
227+ participant AMI as AgentMemoryInjector
228+ participant LAI as LinkedAgentsInjector
229+ participant UPI as UserPromptInjector
230+ participant P as Prompt
231+
232+ AE->>PGP: generate(agent, userPrompt, context)
233+ activate PGP
234+ PGP->>IG: generate(input, next)
235+ activate IG
236+ IG->>P: add system instruction message to prompt
237+ P-->>IG: updatedPrompt
238+ IG-->>PGP: updatedInput
239+ deactivate IG
240+
241+ PGP->>AMI: generate(input, next)
242+ activate AMI
243+ AMI->>P: add agent memory message to prompt
244+ P-->>AMI: updatedPrompt
245+ AMI-->>PGP: updatedInput
246+ deactivate AMI
247+
248+ PGP->>LAI: generate(input, next)
249+ activate LAI
250+ LAI->>P: add linked agents info message to prompt
251+ P-->>LAI: updatedPrompt
252+ LAI-->>PGP: updatedInput
253+ deactivate LAI
254+
255+ PGP->>UPI: generate(input, next)
256+ activate UPI
257+ UPI->>P: add user message to prompt
258+ P-->>UPI: updatedPrompt
259+ UPI-->>PGP: updatedInput
260+ deactivate UPI
261+
262+ PGP-->>AE: finalGeneratedPrompt
263+ deactivate PGP
264+ ```
265+
220266## Implementing PromptContextInterface
221267
222268The ` PromptGeneratorInput ` includes a ` context ` property of type ` PromptContextInterface ` . This interface allows you to
0 commit comments