Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(agents-api): Limit free users to 50 executions and sessions #865

Merged
merged 12 commits into from
Nov 22, 2024

Conversation

creatorrr
Copy link
Contributor

@creatorrr creatorrr commented Nov 22, 2024

Signed-off-by: Diwank Singh Tomer [email protected]


Important

Limit free users to 50 sessions and executions, adding counting functions and tests for these limits.

  • Behavior:
    • Limit free users to 50 sessions and 50 executions by adding MAX_FREE_SESSIONS and MAX_FREE_EXECUTIONS to .env.example and env.py.
    • Implement count_executions() in count_executions.py to count executions for a given developer_id and task_id.
    • Implement count_sessions() in count_sessions.py to count sessions for a given developer_id.
  • API Changes:
    • Update chat() in chat.py to enforce session limits for free users.
    • Update create_task_execution() in create_task_execution.py to enforce execution limits for free users.
  • Tests:
    • Add tests for count_executions() in test_execution_queries.py.
    • Add tests for count_sessions() in test_session_queries.py.
  • Misc:
    • Remove unused imports JinjaTemplate from Tasks.py, RootModel from Tools.py, and RemoteList from temporal.py.

This description was created by Ellipsis for 71043d0. It will automatically update as commits are pushed.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to 06c5041 in 1 minute and 33 seconds

More details
  • Looked at 305 lines of code in 11 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. .env.example:25
  • Draft comment:
    The environment variables MAX_FREE_SESSIONS and MAX_FREE_EXECUTIONS are added, but there is no validation or enforcement logic in the codebase to ensure these limits are respected. Ensure that these limits are enforced in the application logic.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The PR introduces new environment variables for limiting free sessions and executions. These variables are added to the .env.example file and are used in the env.py file. However, there is no validation or enforcement logic in the codebase to ensure these limits are respected. This could lead to potential issues if the limits are not enforced elsewhere in the application.

Workflow ID: wflow_WMwkd1ogkGIQMGdR


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on e6e6068 in 31 seconds

More details
  • Looked at 104 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. agents-api/agents_api/routers/sessions/chat.py:58
  • Draft comment:
    If count_sessions_query is an asynchronous function, it should be awaited to ensure proper execution. Please verify if it needs to be awaited.
  • Reason this comment was not posted:
    Comment did not seem useful.
2. agents-api/agents_api/routers/tasks/create_task_execution.py:126
  • Draft comment:
    If count_executions_query is an asynchronous function, it should be awaited to ensure proper execution. Please verify if it needs to be awaited.
  • Reason this comment was not posted:
    Comment did not seem useful.

Workflow ID: wflow_uTuf3wj7sX6euQOn


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 71043d0 in 26 seconds

More details
  • Looked at 55 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. agents-api/agents_api/routers/tasks/create_task_execution.py:120
  • Draft comment:
    The import Annotated is not used in this file and should be removed to clean up the code.
  • Reason this comment was not posted:
    Marked as duplicate.
2. agents-api/agents_api/routers/tasks/create_task_execution.py:18
  • Draft comment:
    The import Annotated is not used in this file and should be removed to clean up the code.
  • Reason this comment was not posted:
    Comment was not on a valid diff hunk.

Workflow ID: wflow_pw3aSs5mnrgLrslV


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@Vedantsahai18
Copy link
Member

Before merging kindly make sure that the paid users have paid tag in the their respective DB objects.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Skipped PR review on b3a94a6 because no changed files had a supported extension. If you think this was in error, please contact us and we'll fix it right away.

@HamadaSalhab HamadaSalhab merged commit 26a3315 into dev Nov 22, 2024
10 of 14 checks passed
@HamadaSalhab HamadaSalhab deleted the f/rate-limits-free-users branch November 22, 2024 08:12
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.

3 participants