Repository navigation
feat(aikit): declare tool changes as transcript system messages - #110
Merged
Merged
Conversation
Add a transcript SystemMessage that adds or removes tools mid-conversation. Context.tools is the initial declaration; each provider takes changes in place where its transport allows and folds them into the top-level tool list otherwise. - Codex and Copilot Responses share one Responses model with a per-backend request profile, declare every tool in additional_tools items and announce removals as text, keeping the cached prefix across changes - track Responses stream items by output_index, since Copilot rotates item ids on every event - limit Copilot models to the ones the login can reach - leave thinking out for Copilot Claude models that cannot disable it, and send the off effort to Copilot GPT models that take one - send tool_choice and parallel_tool_calls by default for Codex only - read the error message from the raw body when the adapter cannot parse it - replay grammar tool calls from every declared tool, and keep in-place declarations out of requests limited by activeTools - remove ToolCall.addedToolNames; the harness does not store system messages yet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tools can now be added or removed mid-conversation with a transcript
SystemMessage(toolsAdded,toolsRemoved,metadata).Context.toolsis the initial declaration.Transcripthelpers resolve the current tool set and decide, per provider, whether a change is declared in place or folded into the top-level tool list.Codex and Copilot Responses
ResponsesLanguageModel(providers/responses/, moved fromopenai-codex/). AResponsesRequestProfilecaptures each backend's differences:max_output_tokensis sent;additional_toolsitems, starting at the head of the input. The incremental-update notice precedes later declarations, and removals are announced as text. The request input only grows, so the cached prefix survives tool changes.output_index, because Copilot rotates item ids on every event (which split one tool call into an empty call plus a call with arguments).Copilot
model.listshows only the models the login'savailableModelIdsallows, matching each model's API id.thinking: disabled, which Copilot rejected with a 400.reasoning.effort: "none"get it when thinking is off (checked live).tool_choiceandparallel_tool_callsare sent only when the call names a tool choice; Grok rejected them on requests without tools.Other changes
activeTools: a request withactiveToolssends its tools top-level instead of declaring them in place.ToolCall.addedToolNames; the token estimate now countstoolsAdded.Test plan
vp checkandvp run typechecktranscript.test.ts(prefix stability across removals and loads, the tool-search boundary, redefinition, re-declaration) and the Copilot Responses tests (rotating ids, tool fields, off effort)tools.added.e2e.test.tson Codex, Copilot Responses, Copilot Messages, Copilot Chat, Anthropic, OpenAI, Google and OpenRouter, with an artifact for eachmodel.listCopilot filter test