Skip to content

Implement ReAct agent for Duo Chat

Alexander Chueshev requested to merge ac/poc-agent-executor into main

What does this merge request do and why?

This is the PoC MR that doesn't affect our production setup. Please, find more details including our next steps in https://gitlab.com/gitlab-org/gitlab/-/issues/452204

How to set up and validate locally

  1. Set the env variable to get access to the new agent endpoint:

    AIGW_DUOCHAT_EXPERIMENTAL=true
  2. Request with the empty scratchpad:

    curl -X 'POST' \
       'http://localhost:5052/v2/chat/agent' \
       -H 'accept: application/json' \
       -H 'Content-Type: application/json' \
       -d '{
           "question": "What'\''s the title of this issue?",
           "chat_history": "",
           "agent_scratchpad": {
           "agent_type": "react",
               "steps": []
           }
       }'
  3. Request with the existing scratchpad:

    curl -X 'POST' \
     'http://localhost:5052/v2/chat/agent' \
     -H 'accept: application/json' \
     -H 'Content-Type: application/json' \
     -d '{
          "question": "What'\''s the title of this issue?",
          "chat_history": "",
          "agent_scratchpad": {
            "agent_type": "react",
            "steps": [
              {
                "thought": "To get the title and other details of this issue, I need to use the \"issue_reader\" tool.",
                "tool": "issue_reader",
                "tool_input": "What'\''s the title of this issue?",
                "observation": "here is the issue about implementing a PoC for ...."
              }
            ]
          }
       }'
  4. Request with the existing chat history (either string or a list of strings):

    curl -X 'POST' \
      'http://localhost:5052/v2/chat/agent' \
      -H 'accept: application/json' \
      -H 'Content-Type: application/json' \
      -d '{
            "question": "What'\''s your name?",
            "chat_history": ["User: What'\''s your name?", "AI: My name is Skynet."],
            "agent_scratchpad": {
            "agent_type": "react",
            "steps": []
          }
       }'
  5. Request with the pre-defined resource (issue or epic):

    curl -X 'POST' \
      'http://localhost:5052/v2/chat/agent' \
      -H 'accept: application/json' \
      -H 'Content-Type: application/json' \
      -d '{
            "question": "What'\''s the title of this issue?",
            "chat_history": "",
            "agent_scratchpad": {
              "agent_type": "react",
              "steps": []
            },
            "resource": {
              "type": "issue",
              "content": "title: PoC ReAct, description: some description"
           }
        }'

Merge request checklist

  • Tests added for new functionality. If not, please raise an issue to follow up.
  • Documentation added/updated, if needed.
Edited by Alexander Chueshev

Merge request reports