Skip to content

新增CodeactToolSignatureAgentHook将工具的完整签名信息提前注入到 Prompt 中#46

Merged
AQing-527 merged 3 commits intomainfrom
feature/20260331_28832192_add_codeact_tool_to_prompt_1
Mar 31, 2026
Merged

新增CodeactToolSignatureAgentHook将工具的完整签名信息提前注入到 Prompt 中#46
AQing-527 merged 3 commits intomainfrom
feature/20260331_28832192_add_codeact_tool_to_prompt_1

Conversation

@AQing-527
Copy link
Copy Markdown
Collaborator

Description

Related Issue

This pull request introduces a new automatic tool signature injection feature for CodeactTools and bumps the project version to 0.2.2 across all modules. The main enhancement is the addition of a CodeactToolSignatureAgentHook, which injects Python class/function stubs for all registered CodeactTools into the prompt, ensuring the LLM can reference these tools correctly during code generation. The feature is enabled by default but can be toggled via the builder API. Additionally, hook priority constants are updated to accommodate the new hook.

New feature: CodeactTool signature injection

  • Added CodeactToolSignatureAgentHook, which automatically injects Python signatures (class/function stubs) for all registered CodeactTools into the prompt at the BEFORE_AGENT phase, allowing the LLM to reference them correctly in write_code. The hook avoids duplicate injections and provides usage guidelines in the injected message. (assistant-agent-autoconfigure/src/main/java/com/alibaba/assistant/agent/autoconfigure/hook/CodeactToolSignatureAgentHook.java)
  • Updated CodeactAgent.CodeactAgentBuilder to support enabling/disabling the tool signature injection via enableToolSignatureInjection(boolean) (default: enabled). The builder automatically registers the new hook if enabled. (assistant-agent-autoconfigure/src/main/java/com/alibaba/assistant/agent/autoconfigure/CodeactAgent.java) [1] [2] [3] [4]

Infrastructure and configuration

  • Introduced a new hook priority constant CODEACT_TOOL_SIGNATURE_HOOK (priority 8) to ensure the signature injection runs after state initialization but before experience hooks. (assistant-agent-common/src/main/java/com/alibaba/assistant/agent/common/constant/HookPriorityConstants.java)

Version updates

  • Bumped project version from 0.2.1 to 0.2.2 in the root pom.xml and all submodules to reflect the new feature. (pom.xml, assistant-agent-autoconfigure/pom.xml, assistant-agent-common/pom.xml, assistant-agent-core/pom.xml, assistant-agent-evaluation/pom.xml, assistant-agent-extensions/pom.xml, assistant-agent-prompt-builder/pom.xml, assistant-agent-start/pom.xml) [1] [2] [3] [4] [5] [6] [7] [8]

Copy link
Copy Markdown
Collaborator

@canfuu canfuu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AQing-527 AQing-527 enabled auto-merge March 31, 2026 13:02
@AQing-527 AQing-527 merged commit 35ada96 into main Mar 31, 2026
1 check passed
@AQing-527 AQing-527 deleted the feature/20260331_28832192_add_codeact_tool_to_prompt_1 branch March 31, 2026 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants