Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions runtime/ai/analyst_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ai

import (
"context"
"errors"
"fmt"
"strings"
"time"
Expand Down Expand Up @@ -119,7 +120,7 @@ func (t *AnalystAgent) Handler(ctx context.Context, args *AnalystAgentArgs) (*An
_, err := s.CallTool(ctx, RoleAssistant, GetCanvasName, nil, &GetCanvasArgs{
Canvas: args.Canvas,
})
if err != nil {
if err != nil && errors.Is(err, ctx.Err()) { // Don't exit on non-context errors
return nil, err
}

Expand All @@ -138,14 +139,14 @@ func (t *AnalystAgent) Handler(ctx context.Context, args *AnalystAgentArgs) (*An
_, err := s.CallTool(ctx, RoleAssistant, QueryMetricsViewSummaryName, nil, &QueryMetricsViewSummaryArgs{
MetricsView: mvName,
})
if err != nil {
if err != nil && errors.Is(err, ctx.Err()) { // Don't exit on non-context errors
return nil, err
}

_, err = s.CallTool(ctx, RoleAssistant, GetMetricsViewName, nil, &GetMetricsViewArgs{
MetricsView: mvName,
})
if err != nil {
if err != nil && errors.Is(err, ctx.Err()) { // Don't exit on non-context errors
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.

GetMetricsViewName seems like an essential tool call and if that fails, maybe the agent should fail ?

If not, then we should not also fail on the GetCanvasName done just above this ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

won't the agent have the opportunity to retry ?

return nil, err
}
}
Expand All @@ -154,7 +155,7 @@ func (t *AnalystAgent) Handler(ctx context.Context, args *AnalystAgentArgs) (*An
// If no specific dashboard is being explored, we pre-invoke the list_metrics_views tool.
if first && len(metricsViewNames) == 0 {
_, err := s.CallTool(ctx, RoleAssistant, ListMetricsViewsName, nil, &ListMetricsViewsArgs{})
if err != nil {
if err != nil && errors.Is(err, ctx.Err()) { // Don't exit on non-context errors
return nil, err
}
}
Expand Down
Loading