Skip to content

Improve Agentic Chat additional context from web

Suggested improvements

For requests from the web, we should make the following changes to the additional_context block that we add to human messages:

  1. Send a semantically meaningful id (currently empty)
  2. Consider sending something in category other than repository, which is hard-coded (see code comment where it was first added here...I am not sure a unit primitive is actually a thing we care about for this field despite comment)
  3. Consider changing <current_gitlab_page_url> to <current_gitlab_page_path> because it is a path not a URL.

More information

When I send an Agentic Chat request from the IDE, this is what the additional context looks like:

User added additional context below enclosed in <additional_context></additional_context> tags. Each additional context has an ID, category, content and metadata:
<additional_context>
    <id> agent_user_environment_os_info </id>
    <category> agent_user_environment </category>
    <content>
    {"platform":"darwin","architecture":"arm64"}
    </content>
    <metadata>
    {'title': 'Operating System', 'enabled': True, 'subType': 'os', 'icon': 'monitor', 'secondaryText': 'Platform: macOS • Architecture: arm64', 'subTypeLabel': 'System Information'}
    </metadata>
</additional_context>
<additional_context>
    <id> agent_user_environment_shell_info </id>
    <category> agent_user_environment </category>
    <content>
    {"shell_name":"zsh","shell_type":"unix","shell_environment":"native","ssh_session":false,"cwd":"/Users/jessieay/gdk-projects/gdk-ai-gateway"}
    </content>
    <metadata>
    {'title': 'Shell Environment', 'enabled': True, 'subType': 'shell', 'icon': 'terminal', 'secondaryText': 'Shell: zsh', 'subTypeLabel': 'System Terminal'}
    </metadata>
</additional_context>

what is this project about

When I ask a question to Agentic Chat in the web, here is what it looks like after this change:


User added additional context below enclosed in <additional_context></additional_context> tags. Each additional context has an ID, category, content and metadata:
<additional_context>
    <id>  </id>
    <category> repository </category>
    <content>
    <current_gitlab_page_url>/gitlab-duo/gdk-ai-gateway</current_gitlab_page_url>
<current_gitlab_page_title>GitLab Duo / Gdk Ai Gateway · GitLab</current_gitlab_page_title>
    </content>
    <metadata>
    {}
    </metadata>
</additional_context>

read this issue http://gdk.test:3000/gitlab-duo/gdk-ai-gateway/-/issues/1195