-
Notifications
You must be signed in to change notification settings - Fork 224
runtime: support dynamic (session-scoped) toolset injection #1470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: pnkcaht <samzoovsk19@gmail.com>
Signed-off-by: pnkcaht <samzoovsk19@gmail.com>
Update (ACP NewSession wiring documentation)This PR now also documents the intended wiring point for ACP-negotiated MCP servers in While the ACP Go SDK still does not expose
This makes the control flow and ownership model explicit and avoids future ambiguity when completing the ACP integration. Issue statusThis change, together with the runtime support introduced in this PR, However, a follow-up PR will still be required once the ACP SDK exposes MCP server metadata on That follow-up will be mechanical and isolated to ACP ↔ runtime plumbing, without further runtime changes. |
Signed-off-by: pnkcaht <samzoovsk19@gmail.com>
|
Please run |
Okok I'll do it, one moment. |
…MCP init events Signed-off-by: pnkcaht <samzoovsk19@gmail.com>
|
@krissetto done Task lint ✅pnkcaht@pnkcaht:~/Documents/CagentDocker/cagent$ task lint
task: [lint] golangci-lint run
0 issues.
task: [lint] go mod tidy --diff >/dev/null || (echo "go.mod/go.sum files are not tidy" && exit 1)
go: downloading github.com/Microsoft/go-winio v0.6.2
go: downloading github.com/inconshreveable/mousetrap v1.1.0
go: downloading gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
go: downloading github.com/smartystreets/goconvey v1.6.4
go: downloading github.com/charmbracelet/x/exp/golden v0.0.0-20250806222409-83e3a29d542f
go: downloading github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399
go: downloading go.opentelemetry.io/otel/sdk/metric v1.39.0
go: downloading go.uber.org/goleak v1.3.0
go: downloading gopkg.in/yaml.v2 v2.4.0
go: downloading github.com/Masterminds/semver/v3 v3.2.1
go: downloading github.com/onsi/gomega v1.34.1
go: downloading github.com/blevesearch/go-faiss v1.0.26
go: downloading github.com/elazarl/goproxy v1.7.2
go: downloading modernc.org/fileutil v1.3.40
go: downloading github.com/MakeNowJust/heredoc v1.0.0
go: downloading github.com/alecthomas/repr v0.5.2
go: downloading github.com/alecthomas/assert/v2 v2.11.0
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5
go: downloading github.com/gliderlabs/ssh v0.3.8
go: downloading github.com/ncruces/go-strftime v1.0.0
go: downloading modernc.org/cc/v4 v4.27.1
go: downloading modernc.org/ccgo/v4 v4.30.1
go: downloading modernc.org/goabi0 v0.2.0
go: downloading github.com/sebdah/goldie/v2 v2.8.0
go: downloading github.com/kr/pretty v0.3.1
go: downloading github.com/mschoch/smat v0.2.0
go: downloading github.com/google/gofuzz v1.2.0
go: downloading github.com/golang/protobuf v1.5.4
go: downloading gonum.org/v1/gonum v0.16.0
go: downloading github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be
go: downloading modernc.org/strutil v1.2.1
go: downloading modernc.org/sortutil v1.2.1
go: downloading modernc.org/token v1.1.0
go: downloading modernc.org/opt v0.1.4
go: downloading github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d
go: downloading github.com/jtolds/gls v4.20.0+incompatible
go: downloading github.com/kr/text v0.2.0
go: downloading modernc.org/gc/v2 v2.6.5
go: downloading modernc.org/gc/v3 v3.1.1
go: downloading github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1Task Test ✅pnkcaht@pnkcaht:~/Documents/CagentDocker/cagent$ task test
task: [test] CAGENT_MODELS_GATEWAY= OPENAI_API_KEY= ANTHROPIC_API_KEY= GOOGLE_API_KEY= MISTRAL_API_KEY= GITHUB_TOKEN= go test ./...
? github.com/docker/cagent [no test files]
ok github.com/docker/cagent/cmd/root 0.065s
ok github.com/docker/cagent/e2e 0.449s
? github.com/docker/cagent/examples/golibrary/builtintool [no test files]
? github.com/docker/cagent/examples/golibrary/multi [no test files]
? github.com/docker/cagent/examples/golibrary/simple [no test files]
? github.com/docker/cagent/examples/golibrary/stream [no test files]
? github.com/docker/cagent/examples/golibrary/tool [no test files]
? github.com/docker/cagent/gen/proto/cagent/v1 [no test files]
? github.com/docker/cagent/gen/proto/cagent/v1/cagentv1connect [no test files]
ok github.com/docker/cagent/pkg/a2a 0.106s
? github.com/docker/cagent/pkg/acp [no test files]
ok github.com/docker/cagent/pkg/agent 0.029s
? github.com/docker/cagent/pkg/api [no test files]
ok github.com/docker/cagent/pkg/app 0.041s
? github.com/docker/cagent/pkg/app/export [no test files]
ok github.com/docker/cagent/pkg/app/transcript 0.036s
? github.com/docker/cagent/pkg/audio/capture [no test files]
? github.com/docker/cagent/pkg/audio/transcribe [no test files]
? github.com/docker/cagent/pkg/browser [no test files]
? github.com/docker/cagent/pkg/build [no test files]
? github.com/docker/cagent/pkg/chat [no test files]
ok github.com/docker/cagent/pkg/cli 0.045s
ok github.com/docker/cagent/pkg/concurrent 0.008s
ok github.com/docker/cagent/pkg/config 0.334s
ok github.com/docker/cagent/pkg/config/latest 0.024s
? github.com/docker/cagent/pkg/config/types [no test files]
? github.com/docker/cagent/pkg/config/v0 [no test files]
? github.com/docker/cagent/pkg/config/v1 [no test files]
ok github.com/docker/cagent/pkg/config/v2 0.019s
ok github.com/docker/cagent/pkg/config/v3 0.025s
? github.com/docker/cagent/pkg/connectrpc [no test files]
ok github.com/docker/cagent/pkg/content 0.025s
? github.com/docker/cagent/pkg/creator [no test files]
? github.com/docker/cagent/pkg/desktop [no test files]
ok github.com/docker/cagent/pkg/environment 0.020s
ok github.com/docker/cagent/pkg/evaluation 0.042s
ok github.com/docker/cagent/pkg/fake 0.145s
? github.com/docker/cagent/pkg/feedback [no test files]
ok github.com/docker/cagent/pkg/fsx 0.015s
ok github.com/docker/cagent/pkg/gateway 0.010s
ok github.com/docker/cagent/pkg/history 0.009s
ok github.com/docker/cagent/pkg/hooks 0.114s
? github.com/docker/cagent/pkg/httpclient [no test files]
? github.com/docker/cagent/pkg/input [no test files]
ok github.com/docker/cagent/pkg/js 0.018s
ok github.com/docker/cagent/pkg/logging 0.017s
? github.com/docker/cagent/pkg/mcp [no test files]
? github.com/docker/cagent/pkg/memory/database [no test files]
ok github.com/docker/cagent/pkg/memory/database/sqlite 0.027s
ok github.com/docker/cagent/pkg/model/provider 0.043s
ok github.com/docker/cagent/pkg/model/provider/anthropic 0.027s
? github.com/docker/cagent/pkg/model/provider/base [no test files]
ok github.com/docker/cagent/pkg/model/provider/bedrock 0.050s
ok github.com/docker/cagent/pkg/model/provider/dmr 0.044s
ok github.com/docker/cagent/pkg/model/provider/gemini 0.017s
ok github.com/docker/cagent/pkg/model/provider/oaistream 0.014s
ok github.com/docker/cagent/pkg/model/provider/openai 0.022s
? github.com/docker/cagent/pkg/model/provider/options [no test files]
ok github.com/docker/cagent/pkg/model/provider/rulebased 0.034s
ok github.com/docker/cagent/pkg/modelsdev 0.014s
ok github.com/docker/cagent/pkg/oci 0.040s
ok github.com/docker/cagent/pkg/path 0.012s
? github.com/docker/cagent/pkg/paths [no test files]
ok github.com/docker/cagent/pkg/permissions 0.012s
? github.com/docker/cagent/pkg/rag [no test files]
ok github.com/docker/cagent/pkg/rag/chunk 0.012s
? github.com/docker/cagent/pkg/rag/database [no test files]
? github.com/docker/cagent/pkg/rag/embed [no test files]
? github.com/docker/cagent/pkg/rag/fusion [no test files]
? github.com/docker/cagent/pkg/rag/prompts [no test files]
ok github.com/docker/cagent/pkg/rag/rerank 0.013s
ok github.com/docker/cagent/pkg/rag/strategy 0.031s
ok github.com/docker/cagent/pkg/rag/treesitter 0.009s
? github.com/docker/cagent/pkg/rag/types [no test files]
? github.com/docker/cagent/pkg/reference [no test files]
ok github.com/docker/cagent/pkg/remote 0.030s
ok github.com/docker/cagent/pkg/runtime 0.072s
ok github.com/docker/cagent/pkg/server 0.057s
ok github.com/docker/cagent/pkg/session 0.158s
ok github.com/docker/cagent/pkg/skills 0.011s
? github.com/docker/cagent/pkg/sqliteutil [no test files]
? github.com/docker/cagent/pkg/team [no test files]
ok github.com/docker/cagent/pkg/teamloader 0.535s
ok github.com/docker/cagent/pkg/telemetry 0.166s
ok github.com/docker/cagent/pkg/tools 0.009s
? github.com/docker/cagent/pkg/tools/a2a [no test files]
ok github.com/docker/cagent/pkg/tools/builtin 0.152s
ok github.com/docker/cagent/pkg/tools/codemode 0.020s
ok github.com/docker/cagent/pkg/tools/mcp 0.031s
? github.com/docker/cagent/pkg/tui [no test files]
? github.com/docker/cagent/pkg/tui/commands [no test files]
ok github.com/docker/cagent/pkg/tui/components/completion 0.057s
ok github.com/docker/cagent/pkg/tui/components/editor 0.089s
? github.com/docker/cagent/pkg/tui/components/editor/completions [no test files]
ok github.com/docker/cagent/pkg/tui/components/markdown 0.033s
ok github.com/docker/cagent/pkg/tui/components/message 0.029s
ok github.com/docker/cagent/pkg/tui/components/messages 0.071s
ok github.com/docker/cagent/pkg/tui/components/notification 0.038s
ok github.com/docker/cagent/pkg/tui/components/reasoningblock 0.079s
ok github.com/docker/cagent/pkg/tui/components/scrollbar 0.038s
ok github.com/docker/cagent/pkg/tui/components/sidebar 0.055s
ok github.com/docker/cagent/pkg/tui/components/spinner 0.039s [no tests to run]
? github.com/docker/cagent/pkg/tui/components/statusbar [no test files]
? github.com/docker/cagent/pkg/tui/components/tab [no test files]
? github.com/docker/cagent/pkg/tui/components/tool [no test files]
? github.com/docker/cagent/pkg/tui/components/tool/api [no test files]
ok github.com/docker/cagent/pkg/tui/components/tool/defaulttool 0.044s
? github.com/docker/cagent/pkg/tui/components/tool/directorytree [no test files]
? github.com/docker/cagent/pkg/tui/components/tool/editfile [no test files]
? github.com/docker/cagent/pkg/tui/components/tool/handoff [no test files]
ok github.com/docker/cagent/pkg/tui/components/tool/listdirectory 0.034s
? github.com/docker/cagent/pkg/tui/components/tool/readfile [no test files]
? github.com/docker/cagent/pkg/tui/components/tool/readmultiplefiles [no test files]
ok github.com/docker/cagent/pkg/tui/components/tool/searchfilescontent 0.042s
? github.com/docker/cagent/pkg/tui/components/tool/shell [no test files]
? github.com/docker/cagent/pkg/tui/components/tool/todotool [no test files]
? github.com/docker/cagent/pkg/tui/components/tool/transfertask [no test files]
? github.com/docker/cagent/pkg/tui/components/tool/writefile [no test files]
ok github.com/docker/cagent/pkg/tui/components/toolcommon 0.033s
? github.com/docker/cagent/pkg/tui/core [no test files]
? github.com/docker/cagent/pkg/tui/core/layout [no test files]
ok github.com/docker/cagent/pkg/tui/dialog 0.063s
? github.com/docker/cagent/pkg/tui/messages [no test files]
ok github.com/docker/cagent/pkg/tui/page/chat 0.033s
? github.com/docker/cagent/pkg/tui/service [no test files]
ok github.com/docker/cagent/pkg/tui/styles 0.021s
? github.com/docker/cagent/pkg/tui/types [no test files]
? github.com/docker/cagent/pkg/useragent [no test files]
ok github.com/docker/cagent/pkg/userconfig 0.008s
? github.com/docker/cagent/pkg/version [no test files]
pnkcaht@pnkcaht:~/Documents/CagentDocker/cagent$ Task dev ✅pnkcaht@pnkcaht:~/Documents/CagentDocker/cagent$ task dev
task: [test] CAGENT_MODELS_GATEWAY= OPENAI_API_KEY= ANTHROPIC_API_KEY= GOOGLE_API_KEY= MISTRAL_API_KEY= GITHUB_TOKEN= go test ./...
task: Task "lint" is up to date
task: Task "build" is up to date
? github.com/docker/cagent [no test files]
ok github.com/docker/cagent/cmd/root (cached)
ok github.com/docker/cagent/e2e (cached)
? github.com/docker/cagent/examples/golibrary/builtintool [no test files]
? github.com/docker/cagent/examples/golibrary/multi [no test files]
? github.com/docker/cagent/examples/golibrary/simple [no test files]
? github.com/docker/cagent/examples/golibrary/stream [no test files]
? github.com/docker/cagent/examples/golibrary/tool [no test files]
? github.com/docker/cagent/gen/proto/cagent/v1 [no test files]
? github.com/docker/cagent/gen/proto/cagent/v1/cagentv1connect [no test files]
ok github.com/docker/cagent/pkg/a2a (cached)
? github.com/docker/cagent/pkg/acp [no test files]
ok github.com/docker/cagent/pkg/agent (cached)
? github.com/docker/cagent/pkg/api [no test files]
ok github.com/docker/cagent/pkg/app (cached)
? github.com/docker/cagent/pkg/app/export [no test files]
ok github.com/docker/cagent/pkg/app/transcript (cached)
? github.com/docker/cagent/pkg/audio/capture [no test files]
? github.com/docker/cagent/pkg/audio/transcribe [no test files]
? github.com/docker/cagent/pkg/browser [no test files]
? github.com/docker/cagent/pkg/build [no test files]
? github.com/docker/cagent/pkg/chat [no test files]
ok github.com/docker/cagent/pkg/cli (cached)
ok github.com/docker/cagent/pkg/concurrent (cached)
ok github.com/docker/cagent/pkg/config 0.239s
ok github.com/docker/cagent/pkg/config/latest (cached)
? github.com/docker/cagent/pkg/config/types [no test files]
? github.com/docker/cagent/pkg/config/v0 [no test files]
? github.com/docker/cagent/pkg/config/v1 [no test files]
ok github.com/docker/cagent/pkg/config/v2 (cached)
ok github.com/docker/cagent/pkg/config/v3 (cached)
? github.com/docker/cagent/pkg/connectrpc [no test files]
ok github.com/docker/cagent/pkg/content (cached)
? github.com/docker/cagent/pkg/creator [no test files]
? github.com/docker/cagent/pkg/desktop [no test files]
ok github.com/docker/cagent/pkg/environment (cached)
ok github.com/docker/cagent/pkg/evaluation (cached)
ok github.com/docker/cagent/pkg/fake (cached)
? github.com/docker/cagent/pkg/feedback [no test files]
ok github.com/docker/cagent/pkg/fsx (cached)
ok github.com/docker/cagent/pkg/gateway (cached)
ok github.com/docker/cagent/pkg/history (cached)
ok github.com/docker/cagent/pkg/hooks (cached)
? github.com/docker/cagent/pkg/httpclient [no test files]
? github.com/docker/cagent/pkg/input [no test files]
ok github.com/docker/cagent/pkg/js (cached)
ok github.com/docker/cagent/pkg/logging (cached)
? github.com/docker/cagent/pkg/mcp [no test files]
? github.com/docker/cagent/pkg/memory/database [no test files]
ok github.com/docker/cagent/pkg/memory/database/sqlite (cached)
ok github.com/docker/cagent/pkg/model/provider (cached)
ok github.com/docker/cagent/pkg/model/provider/anthropic (cached)
? github.com/docker/cagent/pkg/model/provider/base [no test files]
ok github.com/docker/cagent/pkg/model/provider/bedrock (cached)
ok github.com/docker/cagent/pkg/model/provider/dmr (cached)
ok github.com/docker/cagent/pkg/model/provider/gemini (cached)
ok github.com/docker/cagent/pkg/model/provider/oaistream (cached)
ok github.com/docker/cagent/pkg/model/provider/openai (cached)
? github.com/docker/cagent/pkg/model/provider/options [no test files]
ok github.com/docker/cagent/pkg/model/provider/rulebased (cached)
ok github.com/docker/cagent/pkg/modelsdev (cached)
ok github.com/docker/cagent/pkg/oci (cached)
ok github.com/docker/cagent/pkg/path (cached)
? github.com/docker/cagent/pkg/paths [no test files]
ok github.com/docker/cagent/pkg/permissions (cached)
? github.com/docker/cagent/pkg/rag [no test files]
ok github.com/docker/cagent/pkg/rag/chunk (cached)
? github.com/docker/cagent/pkg/rag/database [no test files]
? github.com/docker/cagent/pkg/rag/embed [no test files]
? github.com/docker/cagent/pkg/rag/fusion [no test files]
? github.com/docker/cagent/pkg/rag/prompts [no test files]
ok github.com/docker/cagent/pkg/rag/rerank (cached)
ok github.com/docker/cagent/pkg/rag/strategy (cached)
ok github.com/docker/cagent/pkg/rag/treesitter (cached)
? github.com/docker/cagent/pkg/rag/types [no test files]
? github.com/docker/cagent/pkg/reference [no test files]
ok github.com/docker/cagent/pkg/remote (cached)
ok github.com/docker/cagent/pkg/runtime (cached)
ok github.com/docker/cagent/pkg/server (cached)
ok github.com/docker/cagent/pkg/session 0.197s
ok github.com/docker/cagent/pkg/skills (cached)
? github.com/docker/cagent/pkg/sqliteutil [no test files]
? github.com/docker/cagent/pkg/team [no test files]
ok github.com/docker/cagent/pkg/teamloader (cached)
ok github.com/docker/cagent/pkg/telemetry (cached)
ok github.com/docker/cagent/pkg/tools (cached)
? github.com/docker/cagent/pkg/tools/a2a [no test files]
ok github.com/docker/cagent/pkg/tools/builtin (cached)
ok github.com/docker/cagent/pkg/tools/codemode (cached)
ok github.com/docker/cagent/pkg/tools/mcp (cached)
? github.com/docker/cagent/pkg/tui [no test files]
? github.com/docker/cagent/pkg/tui/commands [no test files]
ok github.com/docker/cagent/pkg/tui/components/completion (cached)
ok github.com/docker/cagent/pkg/tui/components/editor (cached)
? github.com/docker/cagent/pkg/tui/components/editor/completions [no test files]
ok github.com/docker/cagent/pkg/tui/components/markdown (cached)
ok github.com/docker/cagent/pkg/tui/components/message (cached)
ok github.com/docker/cagent/pkg/tui/components/messages (cached)
ok github.com/docker/cagent/pkg/tui/components/notification (cached)
ok github.com/docker/cagent/pkg/tui/components/reasoningblock (cached)
ok github.com/docker/cagent/pkg/tui/components/scrollbar (cached)
ok github.com/docker/cagent/pkg/tui/components/sidebar (cached)
ok github.com/docker/cagent/pkg/tui/components/spinner (cached) [no tests to run]
? github.com/docker/cagent/pkg/tui/components/statusbar [no test files]
? github.com/docker/cagent/pkg/tui/components/tab [no test files]
? github.com/docker/cagent/pkg/tui/components/tool [no test files]
? github.com/docker/cagent/pkg/tui/components/tool/api [no test files]
ok github.com/docker/cagent/pkg/tui/components/tool/defaulttool (cached)
? github.com/docker/cagent/pkg/tui/components/tool/directorytree [no test files]
? github.com/docker/cagent/pkg/tui/components/tool/editfile [no test files]
? github.com/docker/cagent/pkg/tui/components/tool/handoff [no test files]
ok github.com/docker/cagent/pkg/tui/components/tool/listdirectory (cached)
? github.com/docker/cagent/pkg/tui/components/tool/readfile [no test files]
? github.com/docker/cagent/pkg/tui/components/tool/readmultiplefiles [no test files]
ok github.com/docker/cagent/pkg/tui/components/tool/searchfilescontent (cached)
? github.com/docker/cagent/pkg/tui/components/tool/shell [no test files]
? github.com/docker/cagent/pkg/tui/components/tool/todotool [no test files]
? github.com/docker/cagent/pkg/tui/components/tool/transfertask [no test files]
? github.com/docker/cagent/pkg/tui/components/tool/writefile [no test files]
ok github.com/docker/cagent/pkg/tui/components/toolcommon (cached)
? github.com/docker/cagent/pkg/tui/core [no test files]
? github.com/docker/cagent/pkg/tui/core/layout [no test files]
ok github.com/docker/cagent/pkg/tui/dialog (cached)
? github.com/docker/cagent/pkg/tui/messages [no test files]
ok github.com/docker/cagent/pkg/tui/page/chat (cached)
? github.com/docker/cagent/pkg/tui/service [no test files]
ok github.com/docker/cagent/pkg/tui/styles (cached)
? github.com/docker/cagent/pkg/tui/types [no test files]
? github.com/docker/cagent/pkg/useragent [no test files]
ok github.com/docker/cagent/pkg/userconfig (cached)
? github.com/docker/cagent/pkg/version [no test files]
pnkcaht@pnkcaht:~/Documents/CagentDocker/cagent$ |
Context
ACP allows clients to provide MCP servers dynamically during the session
handshake. These MCP servers are session-scoped and must be injected
into the runtime without mutating agent-level (YAML-defined) configuration.
Before this change, the runtime assumed that all toolsets were statically
defined on the agent, which made it impossible to correctly support
ACP-negotiated MCP servers.
This PR introduces proper support for dynamic, session-scoped toolset
injection in the runtime.
References
What I did
new
WithToolSets(...)runtime option.LocalRuntimeto maintainextraToolsets, separate fromagent/YAML-defined toolsets.
allToolSets()to safely merge:getTools, startup events,handlers) to operate on the combined toolset list.
acp/agent.goacp/registry.goruntime/runtime.goside effects.
What is still missing (out of scope for this PR)
NewSessiononce the ACP SDK exposesthem in
NewSessionRequest.These will be addressed in follow-up PRs once ACP interfaces stabilize.
Before / After
Before
After