Skip to content

Commit e2ae2c3

Browse files
committed
Many control-fixes for AI Agents. Added environment variable AI_AGENT_REASONING_EFFORT for control
1 parent 8afa9c2 commit e2ae2c3

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

ai.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import (
3636
//var model = "gpt-4o-mini"
3737
//var model = "o4-mini"
3838
var standalone bool
39+
3940
//var model = "gpt-5-mini"
4041
var model = "gpt-5-mini"
4142
var fallbackModel = ""
@@ -6801,6 +6802,15 @@ FINALISING:
68016802

68026803
//systemMessage += `If you are missing information (such as emails) to make a list of decisions, just add a single decision which asks them to clarify the input better.`
68036804

6805+
agentReasoningEffort := "minimal"
6806+
6807+
newReasoningEffort := os.Getenv("AI_AGENT_REASONING_EFFORT")
6808+
if len(newReasoningEffort) > 0 {
6809+
if newReasoningEffort == "minimal" || newReasoningEffort == "low" || newReasoningEffort == "medium" || newReasoningEffort == "high" {
6810+
agentReasoningEffort = newReasoningEffort
6811+
}
6812+
}
6813+
68046814
completionRequest := openai.ChatCompletionRequest{
68056815
//Model: "gpt-4o-mini",
68066816
//Model: "gpt-4.1-mini",
@@ -6828,7 +6838,7 @@ FINALISING:
68286838
// Reasoning control
68296839
//ReasoningEffort: "medium", // old
68306840
MaxCompletionTokens: 5000,
6831-
ReasoningEffort: "low",
6841+
ReasoningEffort: agentReasoningEffort,
68326842
Store: true,
68336843
}
68346844

@@ -7350,6 +7360,7 @@ FINALISING:
73507360
if decision.Action == "finish" || decision.Category == "finish" {
73517361
log.Printf("[INFO][%s] Decision %d is a finish decision. Marking the agent as finished...", execution.ExecutionId, decision.I)
73527362
agentOutput.Decisions[decisionIndex].RunDetails.StartedAt = time.Now().Unix()
7363+
agentOutput.Decisions[decisionIndex].RunDetails.CompletedAt = time.Now().Unix()
73537364
agentOutput.Decisions[decisionIndex].RunDetails.Status = "FINISHED"
73547365

73557366

db-connector.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,9 +1336,9 @@ func Fixexecution(ctx context.Context, workflowExecution WorkflowExecution) (Wor
13361336
mappedOutput.CompletedAt = 0
13371337
go sendAgentActionSelfRequest("SUCCESS", workflowExecution, workflowExecution.Results[resultIndex])
13381338

1339-
if debug {
1340-
log.Printf("[DEBUG] All decisions finished but no finish action found.")
1341-
}
1339+
//if debug {
1340+
// log.Printf("[DEBUG] All decisions finished but no finish action found.")
1341+
//}
13421342
}
13431343

13441344
}

0 commit comments

Comments
 (0)