Conversation
08a8db5 to
5660da1
Compare
Documentation CheckNew Documentation Needed
ContextThis PR adds:
The feature is marked Automated review via Coder Tasks |
cb5a27d to
eab5e1d
Compare
| slog.Error(err), | ||
| ) | ||
| if attempt < downloadRetries-1 { | ||
| time.Sleep(downloadRetryDelay) |
There was a problem hiding this comment.
Should ensureBinary have a context? It seems weird that it doesn't. I kinda expected this to be piped through everything for a graceful shutdown.
| // platformBinaries maps GOARCH to download URL and expected SHA-256 | ||
| // digest for each supported platform. | ||
| var platformBinaries = map[string]struct { | ||
| URL string | ||
| SHA256 string | ||
| }{ | ||
| "amd64": { | ||
| URL: "https://github.com/coder/portabledesktop/releases/download/" + portableDesktopVersion + "/portabledesktop-linux-x64", | ||
| SHA256: "a04e05e6c7d6f2e6b3acbf1729a7b21271276300b4fee321f4ffee6136538317", | ||
| }, | ||
| "arm64": { | ||
| URL: "https://github.com/coder/portabledesktop/releases/download/" + portableDesktopVersion + "/portabledesktop-linux-arm64", | ||
| SHA256: "b8cb9142dc32d46a608f25229cbe8168ff2a3aadc54253c74ff54cd347e16ca6", | ||
| }, | ||
| } |
There was a problem hiding this comment.
I'm somewhat skeptical that we should be doing this downloading at all... since customers will likely have to download a browser too, it's maybe best for this change if we just require it on $PATH and customers will need to adjust their workspace images?
There was a problem hiding this comment.
I'd rather pin a specific version of portabledesktop and auto-download it for now in case we need to make breaking changes to the portabledesktop cli.
There was a problem hiding this comment.
We DM'd about it: I'm going to leave the current approach as is in this PR. I'll do a follow up PR next week to only get portabledesktop from PATH and publish a template module to set it up.
| @@ -0,0 +1,3 @@ | |||
| CREATE TYPE chat_type AS ENUM ('computer_use'); | |||
|
|
|||
| ALTER TABLE chats ADD COLUMN chat_type chat_type; | |||
There was a problem hiding this comment.
Should we call this mode instead? Just because chat.chat_type is janky.
coderd/chatd/subagent.go
Outdated
| }, | ||
| ), | ||
| fantasy.NewAgentTool( | ||
| "spawn_computer_use_agent", |
There was a problem hiding this comment.
It's great that this is a separate tool 👍
coderd/chatd/subagent.go
Outdated
| // Check that the Anthropic provider is configured. | ||
| // Computer use requires an Anthropic model; verify | ||
| // the key is available before creating the child chat. | ||
| anthropicAvailable := p.providerAPIKeys.APIKey("anthropic") != "" | ||
| if !anthropicAvailable { | ||
| dbProviders, err := p.db.GetEnabledChatProviders(ctx) | ||
| if err == nil { | ||
| for _, prov := range dbProviders { | ||
| if chatprovider.NormalizeProvider(prov.Provider) == "anthropic" && strings.TrimSpace(prov.APIKey) != "" { | ||
| anthropicAvailable = true | ||
| break | ||
| } | ||
| } | ||
| } | ||
| } | ||
| if !anthropicAvailable { | ||
| return fantasy.NewTextErrorResponse("Computer use requires an Anthropic API key."), nil | ||
| } |
There was a problem hiding this comment.
Would it be better if we just omitted this tool unless Anthropic is configured?
I think the ideal would be that we only inject this if Anthropic is configured and portabledesktop is in the path of the corresponding workspace, but we don't have to do that immediately.
coderd/chatd/chatloop/chatloop.go
Outdated
| // ToolDefiner is an optional interface that AgentTools can | ||
| // implement to control how they appear in Call.Tools. When | ||
| // present, buildToolDefinitions uses the returned Tool instead | ||
| // of constructing a FunctionTool from Info(). | ||
| type ToolDefiner interface { | ||
| ToolDefinition() fantasy.Tool | ||
| } |
There was a problem hiding this comment.
Why is this necessary? Isn't it just a normal tool definition that we return anyways?
There was a problem hiding this comment.
It's a provider tool like web_search. ToolDefiner was old code that remained from before you added support for provider tools in chatd. I got rid of it now.
564f60c to
ea9f7e2
Compare
ea9f7e2 to
0b00ce3
Compare
Implement the backend for the desktop feature for agents.
/api/experimental/chats/$id/desktopendpoint to coderd which exposes a VNC stream from a portabledesktop process running inside the workspacespawn_computer_use_agenttool to chatd, which spawns a subagent that has access to thecomputertool which lets it interact with theportabledesktopprocess running inside the workspaceThere's a follow up frontend PR here: #23006