Phase 11, part 4: agents' limits, recent calls and a pause switch
Each agent has calls a minute and things it may ask to send out a day, checked on every tool call and every request to send; every call is recorded (tool, outcome, time) and the agent's page lists the last 50 and what it's waiting on. Pause refuses all its calls at once. Also fixes each agent's MCP server being shared with others that had the same scopes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -95,6 +95,16 @@ func (s *Server) ask(ctx context.Context, c *mcpserver.Caller, r *approvals.Requ
|
||||
return fmt.Sprintf("Already waiting for approval (request %d): nothing more to do; approvals_status says when it's decided.", p.ID), nil
|
||||
}
|
||||
now := time.Now()
|
||||
// The cap per day on what an agent asks to send out, approved or not.
|
||||
lim, err := users.LimitsOf(s.DB, r.Agent)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if n, err := approvals.AskedSince(s.DB, r.Agent, now.Add(-24*time.Hour)); err != nil {
|
||||
return "", err
|
||||
} else if n >= lim.OutPerDay {
|
||||
return "", fmt.Errorf("this agent may ask to send out %d things a day, and has: try again tomorrow, or ask an admin to raise its limit", lim.OutPerDay)
|
||||
}
|
||||
ok, err := approvals.Allowed(s.DB, r.Agent, r.Class, now)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
||||
Reference in New Issue
Block a user