Skip to content

Commit 8e631f2

Browse files
roagaaliu39getsantry[bot]
authored
feat(explorer): send interactivity flag in client (#103934)
Sends an `is_interactive` flag in the client. Defaults to False, but sets to True for the UI chat endpoint. Part of [AIML-1689: indicator on state whether on Sentry UI or not](https://linear.app/getsentry/issue/AIML-1689/indicator-on-state-whether-on-sentry-ui-or-not) --------- Co-authored-by: Andrew Liu <[email protected]> Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
1 parent f1efad5 commit 8e631f2

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/sentry/seer/endpoints/organization_seer_explorer_chat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def post(
112112
on_page_context = validated_data.get("on_page_context")
113113

114114
try:
115-
client = SeerExplorerClient(organization, request.user)
115+
client = SeerExplorerClient(organization, request.user, is_interactive=True)
116116
if run_id:
117117
# Continue existing conversation
118118
result_run_id = client.continue_run(

src/sentry/seer/explorer/client.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ def execute(cls, organization, **kwargs):
101101
artifact_schema: Optional Pydantic model to generate a structured artifact at the end of the run
102102
custom_tools: Optional list of `ExplorerTool` objects to make available as tools to the agent. Each tool must inherit from ExplorerTool and implement get_params() and execute(). Tools are automatically given access to the organization context. Tool classes must be module-level (not nested classes).
103103
intelligence_level: Optionally set the intelligence level of the agent. Higher intelligence gives better result quality at the cost of significantly higher latency and cost.
104+
is_interactive: Enable full interactive, human-like features of the agent. Only enable if you support *all* available interactions in Seer. An example use of this is the explorer chat in Sentry UI.
104105
"""
105106

106107
def __init__(
@@ -112,6 +113,7 @@ def __init__(
112113
artifact_schema: type[BaseModel] | None = None,
113114
custom_tools: list[type[ExplorerTool]] | None = None,
114115
intelligence_level: Literal["low", "medium", "high"] = "medium",
116+
is_interactive: bool = False,
115117
):
116118
self.organization = organization
117119
self.user = user
@@ -120,6 +122,7 @@ def __init__(
120122
self.intelligence_level = intelligence_level
121123
self.category_key = category_key
122124
self.category_value = category_value
125+
self.is_interactive = is_interactive
123126

124127
# Validate that category_key and category_value are provided together
125128
if category_key == "" or category_value == "":
@@ -160,6 +163,7 @@ def start_run(
160163
"on_page_context": on_page_context,
161164
"user_org_context": collect_user_org_context(self.user, self.organization),
162165
"intelligence_level": self.intelligence_level,
166+
"is_interactive": self.is_interactive,
163167
}
164168

165169
# Add artifact schema if provided
@@ -221,6 +225,7 @@ def continue_run(
221225
"run_id": run_id,
222226
"insert_index": insert_index,
223227
"on_page_context": on_page_context,
228+
"is_interactive": self.is_interactive,
224229
}
225230

226231
body = orjson.dumps(payload, option=orjson.OPT_NON_STR_KEYS)

tests/sentry/seer/endpoints/test_organization_seer_explorer_chat.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def test_post_new_conversation_calls_client(self, mock_client_class: MagicMock):
6969
assert response.data == {"run_id": 456}
7070

7171
# Verify client was called correctly
72-
mock_client_class.assert_called_once_with(self.organization, ANY)
72+
mock_client_class.assert_called_once_with(self.organization, ANY, is_interactive=True)
7373
mock_client.start_run.assert_called_once_with(
7474
prompt="What is this error about?", on_page_context=None
7575
)
@@ -90,7 +90,7 @@ def test_post_continue_conversation_calls_client(self, mock_client_class: MagicM
9090
assert response.data == {"run_id": 789}
9191

9292
# Verify client was called correctly
93-
mock_client_class.assert_called_once_with(self.organization, ANY)
93+
mock_client_class.assert_called_once_with(self.organization, ANY, is_interactive=True)
9494
mock_client.continue_run.assert_called_once_with(
9595
run_id=789, prompt="Follow up question", insert_index=2, on_page_context=None
9696
)

0 commit comments

Comments
 (0)