Skip to content

ton of changes for agent#364

Open
satti-hari-krishna-reddy wants to merge 9 commits intoShuffle:mainfrom
satti-hari-krishna-reddy:agent-loop-fix
Open

ton of changes for agent#364
satti-hari-krishna-reddy wants to merge 9 commits intoShuffle:mainfrom
satti-hari-krishna-reddy:agent-loop-fix

Conversation

@satti-hari-krishna-reddy
Copy link
Copy Markdown
Collaborator

No description provided.

@satti-hari-krishna-reddy satti-hari-krishna-reddy changed the title ton of changes ton of changes for agent Mar 30, 2026
ai.go Outdated
execution.Results = append(execution.Results, abortResult)
}

execution.Status = "FINISHED" // Mark execution as finished so it stops processing
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I still don't trust this lol

ai.go Outdated
}

// Check org-level monthly token limit BEFORE each LLM call
if project.Environment == "cloud" && len(execution.Workflow.OrgId) > 0 {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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" {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I asked clearly on our call "Are you tracking input tokens AND output tokens?"

You said yes. Where is it?

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