> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes. # onSummary > Handle post-prompt summaries generated after a conversation ends. [set-post-prompt]: /docs/server-sdks/reference/typescript/agents/agent-base/set-post-prompt [set-post-prompt-url]: /docs/server-sdks/reference/typescript/agents/agent-base/set-post-prompt-url Lifecycle hook invoked when a post-prompt summary is received after a conversation ends. Override this method in a subclass to process summaries -- for example, saving them to a CRM, triggering follow-up workflows, or logging call outcomes. A post-prompt must be configured via [`setPostPrompt()`][set-post-prompt] for summaries to be generated. > **Note** > > The default implementation does nothing. You must override it in a subclass or set a > [`setPostPromptUrl()`][set-post-prompt-url] > to receive summaries at an external endpoint. ## **Parameters** **`summary`** `PostPromptData | null` — required The summary object generated by the AI based on your post-prompt instructions. `null` if no summary could be extracted from the response. --- **`rawData`** `PostPrompt` — required The complete raw POST data from the post-prompt request, including metadata like `call_id` and the full AI response. --- ## **Returns** `void | Promise` ## **Example** ```typescript {15} import { AgentBase } from '@signalwire/sdk'; class SupportAgent extends AgentBase { constructor() { super({ name: 'support', route: '/support' }); this.setPromptText('You are a helpful customer support agent.'); this.setPostPrompt(` Summarize this call as JSON: - intent: caller's primary intent - resolved: yes/no/partial - sentiment: positive/neutral/negative `); } override async onSummary( summary: Record | null, rawData: Record, ): Promise { if (summary) { const callId = (rawData.call_id as string) ?? 'unknown'; console.log(`Call ${callId} summary:`, summary); // await saveToDatabase(callId, summary); } } } const agent = new SupportAgent(); await agent.serve(); ``` > Handle post-prompt summaries generated after a conversation ends.