Skip to content

Chat participant API #199908

Closed
Closed

Description

@roblourens

We have finalized the Language Model and Chat Participant API 🚀
Thus, you can now publish your extensions to the VS Marketplace. This API is finalized in VS Code Insiders, and will be finalized in VS Code Stable in July. In your package.json, you should set

"engines": {
	"vscode": "^1.90.0"
},

and VS Code Stable will gracefully handle your extensions and ignore your usage of Language Model and Chat API until the API gets finalized in Stable in July. Full docs https://code.visualstudio.com/api/extension-guides/chat

We are excited to see what you build ✨


-- Proposal dts: https://github.com/microsoft/vscode/blob/main/src/vscode-dts/vscode.proposed.chatParticipant.d.ts

Extension authors can subscribe to this issue to get updates about the proposed chat agent API. There may still be breaking changes coming, and I will post here whenever a breaking change is made.

I'm also interested in feedback about how you might use this API.

Current TODOs

  • Need to enable agents to identify sessions uniquely and store state, including across a window reload
  • Should be able to use shouldRepopulate for agents
    • Maybe this should be the default behavior for agents
  • ChatAgentReplyFollowup should parameterize the agent and slash command names, don't require the agent to include them in the prompt as text
    • Maybe this goes for variables too, but variables like #file are complex
  • Enable references and progress messages from chat variable resolvers #204539
  • ChatAgentContentReference needs to support https URIs #203822
  • Change the history context shape to be a flat list of messages, instead of request/response pairs
  • Understand how duplicate agent IDs should be handled
  • Enable agents to resolve a variable value on-demand, instead of resolving all variables before invoking the agent

  • Add a persist flag to ChatAgentProgressMessage for it to stay visible with a ✔️ even when more content has been added.
    • This would be useful when you want the progress message to remain and show what happened, eg in representing a function call. I've seen multiple extension authors add their own version of this just with text.
  • Better support for /help with chat agents #197081

  • ChatAgentCommandFollowup should become a progress message instead of a followup
  • In history, agents have to parse agent names and slash commands from the raw ChatMessage. They shouldn't have to understand the input syntax- the type in history should be related to the request and progress/result types that we already have.
  • Add generic type parameter for the type of the result, which can include custom properties
  • 'variables' proposal is referenced from chatAgents2, need to merge it in
  • Merge ChatAgentTask and ChatAgentProgressMessage #200598

Activity

  1. added this to the milestone on Dec 3, 2023
  2. self-assigned this
    on Dec 3, 2023
  3. roblourens commented on Dec 3, 2023

    @roblourens
    MemberAuthor

    November additions

    • Send a ChatAgentProgressMessage to show progress steps on your response. @workspace uses this.
      /**
      * Is displayed in the UI to communicate steps of progress to the user. Should be used when the agent may be slow to respond, e.g. due to doing extra work before sending the actual request to the LLM.
      */
      export interface ChatAgentProgressMessage {
      message: string;
      }
    • Implement a ChatAgentCompletionItemProvider for variables to show up that are only for this agent. Other chat variables are global.
      export interface ChatAgentCompletionItemProvider {
      provideCompletionItems(query: string, token: CancellationToken): ProviderResult<ChatAgentCompletionItem[]>;
      }
  4. bionicles commented on Dec 7, 2023

    @bionicles
  5. ntindle commented on Dec 9, 2023

    @ntindle

    Has any research been done into the agent protocol for this?

  6. InTheCloudDan commented on Dec 10, 2023

    @InTheCloudDan

    Do you have any example use cases of ChatAgentCompletionItemProvider?

  7. pelikhan commented on Dec 11, 2023

    @pelikhan
    Member
    • Do you have more information about the options to access.makeRequest?
    • Do you have more information about ChatAgentUsedContext and MappedEditsProvider?
  8. roblourens commented on Dec 13, 2023

    @roblourens
    MemberAuthor

    bion howard (@bionicles) I wouldn't rely on Copilot Chat for legal advice, talking to a lawyer may be a good idea.

    Nicholas Tindle (@ntindle) I think that's a different use of the term "agent" than how we're using it here, where it's just a UX paradigm for an extension that can execute a chat query. That might continue to be a point of confusion as people work more on AI agents that plan and use tools to accomplish a task in multiple steps.

    Dan O'Brien (@InTheCloudDan) Not a good example, sorry, I'll try to add one to the API sample this month. The API might need a little more polish.

    Peli de Halleux (@pelikhan) The current concept is that those options could be used differently by different chat providers. The copilot chat provider takes a numeric option n.

    Re: MappedEditsProvider- I think this is sort of in an experimental state, there is one that is implemented by the Copilot Chat extension and just tries to fix the indentation of pasted codeblocks based on the indentation in ChatAgentUsedContext.

  9. ntindle commented on Dec 13, 2023

    @ntindle

    How would you feel about calling it one of the following then sidekick, partner, assistant, or tool?

    The name confusion I can see continuing

  10. bionicles commented on Dec 19, 2023

    @bionicles
  11. roblourens commented on Jan 12, 2024

    @roblourens
    MemberAuthor

    Breaking change in the next Insiders:

    Renamed ChatVariableContext#message to prompt

    export interface ChatVariableContext {
    /**
    * The message entered by the user, which includes this variable.
    */
    prompt: string;
    }

  12. 234 remaining items

  13. isidorn commented on May 17, 2024

    @isidorn

    Dan O'Brien (@InTheCloudDan) good catch. I just fixed it. Thanks

  14. isidorn commented on May 17, 2024

    @isidorn

    As Rob said we have finalized the Language Model and Chat Participant API

    Thus, you can now publish your extensions to the VS Marketplace. This API is finalized in VS Code Insiders, and will be finalized in VS Code Stable in July. Thus we suggest that you use an engines: ^1.90.0 property in your package.json, and VS Code Stable will gracefully handle your extensions and ignore your usage of Language Model and Chat API until the API gets finalized in Stable in July.

    Full docs https://code.visualstudio.com/api/extension-guides/chat

    We are excited to see what you build ✨

    Thus I am going ahead and closing this issue. We will create follow-up issues for API that is still in proposed state. Here's the issue for Variables #212995

  15. roblourens commented on May 23, 2024

    @roblourens
    MemberAuthor

    Two more issues to follow for API updates. I'm very interested to hear what you would want to use custom chat variables or tools for, so please let me know!

  16. undesicimo commented on May 23, 2024

    @undesicimo

    Congratulations! been watching this for months so thrilled

  17. jasonwang82 commented on May 23, 2024

    @jasonwang82
  18. isidorn commented on May 23, 2024

    @isidorn

    jasonwang82 yes. But, this is unrelated to chat participant API.

  19. matv-stripe commented on May 23, 2024

    @matv-stripe

    Is it possible to stream results in our Markdown that include a dropdown?

    We want to add a "References" collapsable section that is closed by default, similar to how Copilot shows "Used 1 reference >" here

    CleanShot 2024-05-23 at 13 44 21@2x

    I dont seem to see that option in the code here

    renderableResponse.forEach((part, index) => {

  20. roblourens commented on May 23, 2024

    @roblourens
    MemberAuthor

    You can call reference on the response stream to add to that list, but you can't add your own.

  21. isidorn commented on May 24, 2024

    @isidorn

    We just did a breakout session at Microsoft build on Chat Participant API.
    Make sure to check it out https://www.youtube.com/watch?v=YI7kjWzIiTM

  22. amitjoshi438 commented on Jun 17, 2024

    @amitjoshi438

    Yeah, that makes sense. I'll add that

    Hi roblourens is there any tracking link for this?

    #199908 (comment)

  23. roblourens commented on Jun 18, 2024

    @roblourens
    MemberAuthor
  24. locked and limited conversation to collaborators on Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions