Skip to content

Conversation

@skoob13
Copy link
Contributor

@skoob13 skoob13 commented Nov 11, 2025

Problem

We want to create more specialized agents within the single execution loop, so the context is preserved and the context window is not overwhelmed by it. This PR introduces three new modes under the feature flag phai-agent-modes: product analytics, SQL, and session replay.

Demo screenshot

Screenshot 2025-11-16 at 17 19 10

Changes

  • Added new mode presets with manual registry–going to create an automated registry for the products directory later.
  • Created new tools that improved generation performance: create_insight, execute_sql, switch_mode, summarize_sessions.
  • Improved prompting around query execution, so we output prompt schemas.

How did you test this code?

Manual testing & unit tests

@skoob13 skoob13 changed the title Feat/agent modes feat(ph-ai): agent modes Nov 11, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 11, 2025

Size Change: +1.18 kB (+0.03%)

Total Size: 3.42 MB

Filename Size Change
frontend/dist/toolbar.js 3.42 MB +1.18 kB (+0.03%)

compressed-size-action

@wiz-7ad640923b
Copy link

wiz-7ad640923b bot commented Nov 12, 2025

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities -
Data Finding Sensitive Data 1 Medium
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations -
SAST Finding SAST Findings -
Total 1 Medium

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension.

@posthog-bot
Copy link
Contributor

Visual regression: Storybook UI snapshots updated

Mode: UPDATE (triggered by human commit 5417f73)

Changes: 2 snapshots (2 modified, 0 added, 0 deleted)

What this means:

  • Snapshots have been automatically updated to match current rendering
  • Next CI run will switch to CHECK mode to verify stability
  • If snapshots change again, CHECK mode will fail (indicates flapping)

Next steps:

  • Review the changes to ensure they're intentional
  • Approve if changes match your expectations
  • If unexpected, investigate component rendering

Review snapshot changes →

@skoob13 skoob13 force-pushed the feat/agent-modes branch 3 times, most recently from 6013386 to 338e8c9 Compare November 16, 2025 14:59
@skoob13 skoob13 requested review from a team, Twixes and kappa90 November 17, 2025 10:33
@skoob13 skoob13 marked this pull request as ready for review November 17, 2025 10:33
@posthog-bot posthog-bot requested a review from a team November 17, 2025 10:34
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

52 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile
React with 👍 or 👎 to share your feedback on this new summary format

@skoob13 skoob13 removed the request for review from a team November 17, 2025 10:36
Copy link
Contributor

@kappa90 kappa90 left a comment

Choose a reason for hiding this comment

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

Was already checking this during the weekend, all super good, just left a few comments

return start_message.content
return ""

def _has_agent_modes_feature_flag(self) -> bool:
Copy link
Contributor

Choose a reason for hiding this comment

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

This is repeated three times, one in utils, one here and one somewhere in the modes files

from ee.hogai.utils.prompt import format_prompt_string
from ee.hogai.utils.types.base import AssistantNodeName, AssistantState, NodePath

INSIGHT_TOOL_PROMPT = """
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe worth moving this to its own file, since it's massive

@skoob13 skoob13 added the evals-ready Whether to run AI evals on this PR. label Nov 17, 2025
Copy link
Contributor

@tatoalo tatoalo left a comment

Choose a reason for hiding this comment

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

Looks really nice, awaiting on evals! Thanks for putting this behind FF so we can actually test this nicely E2E 🙏🏻

return insert_messages_before_start(state.messages, context_messages, start_id=state.start_id)

def _get_mode_prompt(self, mode: AgentMode | None) -> str:
return format_prompt_string(CONTEXT_MODE_PROMPT, mode=mode.value if mode else AgentMode.PRODUCT_ANALYTICS.value)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: having product analytics as default does make sense, we could probably have a DEFAULT_AGENT_MODE constant to be more direct about this, not a biggie

@skoob13 skoob13 enabled auto-merge November 18, 2025 08:03
@skoob13 skoob13 removed the evals-ready Whether to run AI evals on this PR. label Nov 18, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

53 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile
React with 👍 or 👎 to share your feedback on this new summary format

@skoob13 skoob13 added this pull request to the merge queue Nov 19, 2025
@skoob13 skoob13 removed this pull request from the merge queue due to a manual request Nov 19, 2025
@skoob13 skoob13 enabled auto-merge November 19, 2025 16:02
@skoob13 skoob13 added this pull request to the merge queue Nov 19, 2025
Merged via the queue into master with commit 4c82d58 Nov 19, 2025
193 checks passed
@skoob13 skoob13 deleted the feat/agent-modes branch November 19, 2025 16:28
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.

5 participants