ton of changes for agent#364
Open
satti-hari-krishna-reddy wants to merge 9 commits intoShuffle:mainfrom
Open
Conversation
…shuffle-shared into agent-loop-fix
frikky
reviewed
Mar 30, 2026
ai.go
Outdated
| execution.Results = append(execution.Results, abortResult) | ||
| } | ||
|
|
||
| execution.Status = "FINISHED" // Mark execution as finished so it stops processing |
Member
There was a problem hiding this comment.
Wouldn't status here be "ABORTED"?
|
|
||
| // abortAgentExecution is the single, canonical way to terminate an agent run early. | ||
| // Callers must return immediately after this call. | ||
| func abortAgentExecution(ctx context.Context, execution WorkflowExecution, startNode Action, base AgentOutput, abortLabel, reason string) (Action, error) { |
Member
There was a problem hiding this comment.
How does this actually work? Just force stop the workflow? No details in the Agent itself?
Are you making sure it updates relevant cache as well? What about the "Finish" decision?
| return startNode, errors.New(reason) | ||
| } | ||
|
|
||
| func sendAITokenLimitAlert(ctx context.Context, execution WorkflowExecution, fullOrg *Org, tokenLimit, monthlyTokensUsed int64) { |
Member
There was a problem hiding this comment.
Shouldn't this use the same as our existing AI Token usage alert?
Why would it be separate? Easily can create spam.
|
|
||
| // HARD ABORT — code-side enforcement regardless of LLM behavior. | ||
| const maxAgentFailureRounds = 5 | ||
| const maxAgentFailureRounds = 4 |
ai.go
Outdated
| } | ||
|
|
||
| // Check org-level monthly token limit BEFORE each LLM call | ||
| if project.Environment == "cloud" && len(execution.Workflow.OrgId) > 0 { |
Member
There was a problem hiding this comment.
Does this take into account self-hosted LLMs?
| orgStatistics.TotalAgentExecutions += int64(increment) | ||
| orgStatistics.MonthlyAgentExecutions += int64(increment) | ||
| orgStatistics.DailyAgentExecutions += int64(increment) | ||
| } else if dataType == "agent_tokens" { |
Member
There was a problem hiding this comment.
I asked clearly on our call "Are you tracking input tokens AND output tokens?"
You said yes. Where is it?
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.
No description provided.