feat: introduce new agent - [#3517117]
This PR introduces a new AI agent, the BlockContentAgent
, designed to handle tasks related to Drupal block content types. Reviewers should concentrate on the following specific changes:
-
prompts/block_content_agent/answerQuestion.yml
:- Creation of a new prompt file
answerQuestion.yml
tailored for answering questions about block content types. - Review the prompt's
introduction
,formats
, andone_shot_learning_examples
to ensure they are clear, accurate, and cover various question types.
- Creation of a new prompt file
-
prompts/block_content_agent/determineBlockContentTypeTask.yml
:- Creation of a new prompt file
determineBlockContentTypeTask.yml
to analyze user input and determine the intended action (create, edit, delete, information). - Review the prompt's
introduction
,possible_actions
,formats
, andone_shot_learning_examples
to ensure they are comprehensive and align with the agent's capabilities.
- Creation of a new prompt file
-
src/Plugin/AiAgent/BlockContentAgent.php
:- Creation of the
BlockContentAgent
class, which extendsAiAgentBase
and implementsAiAgentInterface
. - Review the class properties, including
$questions
,$result
,$data
, and$taskType
. - Examine the
create
method and its dependency injection. - Verify the correctness of methods like
getId
,agentsNames
, andagentsCapabilities
, paying close attention to the agent's name, ID, description, inputs, and outputs. - Analyze the implementation of methods such as
setData
,isAvailable
,isNotAvailableMessage
,getRetries
,getData
,answerQuestion
,getHelp
, andhasAccess
, ensuring they are appropriate for the agent's functionality. - Critically review the
determineSolvability
method and the logic for determining the task type. - Carefully examine the
solve
method and the methods it calls (createBlockContentType
,editBlockContentType
), ensuring correct handling of create, edit, and other actions. Note the placeholder fordelete
. - Assess the
checkRequirements
method and its implementation. - Analyze helper methods like
getBlockContentTypes
,getBlockContentTypesAsString
,getVerboseBlockContentTypesAsString
, anddoesBlockContentTypeExist
, verifying their accuracy and efficiency.
- Creation of the
Key Review Focus:
- Prompt definitions and their effectiveness in guiding the AI.
- Agent capabilities and their accurate representation in the code.
- Correctness of the agent's logic for handling different tasks.
- Adherence to Drupal coding standards and best practices.
Edited by Andrii Podanenko