Skip to content

Commit 905df1c

Browse files
committed
refactor: Remove reasoning field from completion logic and update prompts for agentic execution
1 parent 9e34ec9 commit 905df1c

File tree

4 files changed

+6
-25
lines changed

4 files changed

+6
-25
lines changed

packages/core/src/executors/sampling/agentic-sampling-executor.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,12 @@ export class SamplingExecutor extends BaseSamplingExecutor {
108108
const toolCallData = parsedData;
109109

110110
if (toolCallData.decision === "complete") {
111-
const reasoning = (toolCallData.reasoning as string) || "Task completed";
112-
return this.createCompletionResult(reasoning);
111+
return this.createCompletionResult("Task completed");
113112
}
114113

115114
try {
116-
// Extract tool arguments (everything except action and reasoning)
117-
const { action: _action, reasoning: _reasoning } = toolCallData;
115+
// Extract tool arguments (everything except action and decision)
116+
const { action: _action, decision: _decision, ..._toolArgs } = toolCallData;
118117

119118
const toolResult = await this.agenticExecutor.execute(
120119
toolCallData,
@@ -178,8 +177,7 @@ export class SamplingExecutor extends BaseSamplingExecutor {
178177
I will now use agentic sampling to complete the following task: "${userRequest}"
179178
180179
When I need to use a tool, I should specify the tool name in 'action' and provide tool-specific parameters as additional properties.
181-
When the task is complete, I should use "action": "complete".
182-
I must always provide reasoning for my actions.`;
180+
When the task is complete, I should use "action": "complete".`;
183181

184182
// Use JSON instruction injection pattern
185183
return this.injectJsonInstruction({

packages/core/src/executors/sampling/workflow-sampling-executor.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ export class WorkflowSamplingExecutor extends BaseSamplingExecutor {
8383
const toolCallData = parsedData as Record<string, unknown>;
8484

8585
if (toolCallData.decision === "complete") {
86-
const reasoning = (toolCallData.reasoning as string) || "Task completed";
87-
return this.createCompletionResult(reasoning);
86+
return this.createCompletionResult("Task completed");
8887
}
8988

9089
try {

packages/core/src/factories/args-def-factory.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ Workflow step definitions - provide ONLY on initial call.
150150

151151
forAgentic: function (
152152
toolNameToDetailList: [string, unknown][],
153-
sampling: boolean = false,
153+
_sampling: boolean = false,
154154
ACTION_KEY: string = "action",
155155
NEXT_ACTION_KEY: string = "nextAction",
156156
): JSONSchema {
@@ -187,14 +187,6 @@ Workflow step definitions - provide ONLY on initial call.
187187
...depGroups,
188188
};
189189

190-
// Add reasoning field for sampling mode
191-
if (sampling) {
192-
baseProperties.reasoning = {
193-
type: "string",
194-
description: "Explain your reasoning for this action",
195-
};
196-
}
197-
198190
const requiredFields = [ACTION_KEY, "decision"];
199191

200192
return {

packages/core/src/prompts/index.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ export const SystemPrompts = {
6060
- **ADVANCE STEP**: Set \`decision: "proceed"\` to move to next step
6161
- **RETRY STEP**: Set \`decision: "retry"\`
6262
- **COMPLETE WORKFLOW**: Set \`decision: "complete"\` when ready to finish
63-
- Use \`reasoning\` action for thinking/analysis
6463
6564
**🚫 Do NOT include \`steps\` parameter during normal execution**
6665
**✅ Include \`steps\` parameter ONLY when restarting workflow with \`init: true\`**
@@ -84,15 +83,13 @@ export const SystemPrompts = {
8483
8584
**⚡ AGENTIC EXECUTION RULES:**
8685
- Each response demonstrates autonomous reasoning and decision-making
87-
- Use "reasoning" field to show your independent thought process
8886
- Make self-directed choices about which tools to use and when
8987
- Adapt your approach based on previous results without external guidance
9088
- Use "decision: complete" when you autonomously determine the task is finished
9189
9290
**🔄 JSON Response Format (Agentic Decision Output):**
9391
You MUST respond with a JSON object that demonstrates your autonomous decision:
9492
- action: Your self-selected tool name
95-
- reasoning: Your independent reasoning and decision-making process
9693
- decision: "proceed" (continue execution), "retry" (retry current step), or "complete" (finish task)
9794
- [tool parameters]: Tool-specific parameters you autonomously determine
9895
@@ -102,7 +99,6 @@ You MUST respond with a JSON object that demonstrates your autonomous decision:
10299
**🎯 AGENTIC CONSTRAINTS:**
103100
- Response must be pure JSON demonstrating autonomous decision-making
104101
- Invalid JSON indicates failure in agentic reasoning
105-
- Missing "reasoning" field shows lack of autonomous thought process
106102
- Tool parameters must reflect your independent analysis and planning`,
107103

108104
/**
@@ -123,7 +119,6 @@ You MUST respond with a JSON object that demonstrates your autonomous decision:
123119
124120
**⚡ AGENTIC EXECUTION RULES (Subsequent Calls):**
125121
- Each response demonstrates autonomous reasoning and decision-making within workflow context
126-
- Use "reasoning" field to show your independent thought process for current workflow step
127122
- Make self-directed choices about step execution, retry, or advancement
128123
- Adapt your approach based on previous step results without external guidance
129124
- Balance workflow structure with autonomous flexibility
@@ -133,21 +128,18 @@ You MUST respond with a JSON object for workflow execution:
133128
134129
**For Workflow Initialization (First Call):**
135130
- action: "{toolName}"
136-
- reasoning: Your autonomous workflow planning process
137131
- init: true
138132
- steps: Autonomously designed workflow steps array
139133
- [other workflow parameters]: As you autonomously determine
140134
141135
**For Step Execution (Subsequent Calls):**
142136
- action: "{toolName}"
143-
- reasoning: Your independent analysis of current step and next decision
144137
- decision: "proceed" (advance), "retry" (retry), or "complete" (finish - sampling mode only)
145138
- [step parameters]: Tool-specific parameters you autonomously determine for current step
146139
147140
**🎯 AGENTIC WORKFLOW CONSTRAINTS:**
148141
- Response must be pure JSON demonstrating autonomous decision-making within workflow structure
149142
- Invalid JSON indicates failure in agentic workflow reasoning
150-
- Missing "reasoning" field shows lack of autonomous thought process
151143
- Tool parameters must reflect your independent analysis and workflow planning
152144
- Balance autonomous decision-making with structured workflow progression
153145

0 commit comments

Comments
 (0)