# Using the Complaint Agent (QMS)

In Vaults using Veeva AI for Quality, Veeva QMS provides a Complaint Agent that can generate a narrative summary of the investigation or CAPA plan for a _Complaint_. The summary includes information from key related records, such as _Investigations_ and _Root Causes_ for an investigation summary, and _CAPA Actions_ for a CAPA plan summary. The Complaint Agent can also answer questions about a _Complaint_ record and its related records via Veeva AI Chat.

## Supported Objects & Object Types

The Complaint Agent supports the following objects and object types:

* _Complaint_: _Pharma Complaint_ object type
* _Quality Event_: _Complaint_ object type

The Complaint Agent does not support custom objects and object types.

Your Vault may process complaints using either a standalone _Complaint_ object or a _Quality Event_ object of a _Complaint_ object type. In this article, these objects are collectively referred to as _Complaints_.

## How to Generate a Narrative Summary

To generate a narrative summary:

1. Navigate to a _Complaint_ record with a supported object type.
2. Click **Edit**.
3. Next to the _Investigation Summary & Conclusion_ or _CAPA Plan Summary_ field, click the **Generate Summary** (<img class="inline" src="https://platform.veevavault.help/assets/images/quality-qms-nsg-icon.png" alt="Narrative Summary Generation Icon" style="" />) icon to invoke the Agent for summary generation.
4. Review the generated summary. 
5. Click **Save**.

When you click **Save**, the narrative summary is saved to the field from which you generated it.

For the best results, we recommend generating a narrative summary only when a record is in its later lifecycle states, and when the data is expected to be most complete.

## Using the Ask Questions Action 

You can ask questions about a _Complaint_ record using Veeva AI Chat. Click the **Veeva AI** (<img class="inline" src="https://platform.veevavault.help/assets/images/Global-AI-Chat-Icon.png" alt="Global AI Chat Icon" style="" />) icon in the upper right of the Vault interface while viewing a record, and begin typing your question into the text box. You can ask questions about the record you are currently viewing, as well as the records related to the primary record.

## Related Permissions

To interact with the Complaint Agent, you must have the following permissions:

<table>
  <tr>
   <th>Type</th>
   <th>Permission Label</th>
   <th>Controls</th>
  </tr>
  <tr>
   <td>Security Profile</td>
   <td>Agents: Complaint Agent: Execute</td>
   <td>Ability to generate a narrative summary using the Complaint Agent.</td>
  </tr>
  <tr>
   <td>Security Profile</td>
   <td>Agents: Super Agent: Execute</td>
   <td>Ability to ask questions via Veeva AI Chat about a <em>Complaint</em> record.</td>
  </tr>
  <tr>
   <td>Security Profile</td>
   <td>Application: Vault Actions: Veeva AI Chat: Use Chat</td>
   <td>Ability to view and interact with Veeva AI Chat.</td>
  </tr>
  <tr>
   <td>Security Profile</td>
   <td>Objects: Complaint: Pharma Complaint: Edit</td>
   <td>Ability to edit <em>Pharma Complaint</em> records.</td>
  </tr>
  <tr>
   <td>Security Profile</td>
   <td>Objects: Complaint: Object Field Permissions: CAPA Plan Summary, Investigation Summary & Conclusion: Edit</td>
   <td>Ability to edit relevant fields on <em>Complaint</em> records.</td>
  </tr>
  <tr>
   <td>Atomic Security</td>
   <td>Complaint Lifecycle: [state]: Atomic Security: Fields: CAPA Plan Summary, Investigation Summary & Conclusion: Edit</td>
   <td>Ability to edit relevant fields in applicable lifecycle states of the <em>Complaint Lifecycle</em>.</td>
  </tr>
</table>