-
Notifications
You must be signed in to change notification settings - Fork 904
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): Transitions stream SSE endpoint #485
Conversation
Signed-off-by: Diwank Singh Tomer <[email protected]>
Signed-off-by: Diwank Singh Tomer <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Changes requested. Reviewed everything up to ed4d2ec in 1 minute and 6 seconds
More details
- Looked at
1346
lines of code in29
files - Skipped
2
files when reviewing. - Skipped posting
3
drafted comments based on config settings.
1. agents-api/agents_api/activities/task_steps/set_value_step.py:35
- Draft comment:
Reassigningset_value_step
to a new definition withactivity.defn
is unnecessary and can be confusing. Consider defining the function once and usingactivity.defn
directly on it.
@activity.defn(name="set_value_step")
async def set_value_step(
- Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The comment addresses a change made in the diff, specifically the reassignment ofset_value_step
. The suggestion to useactivity.defn
directly on the function is a valid code quality improvement, as it simplifies the code and reduces potential confusion.
The reassignment might have a specific purpose, such as conditional logic for testing, which the comment does not acknowledge. The comment could be missing context about why the reassignment is done this way.
Even if there is a specific reason for the reassignment, the comment still highlights a potential area for simplification and clarity, which is valuable feedback.
The comment is about a change made in the diff and provides a valid suggestion for code improvement. It should be kept.
2. agents-api/agents_api/workflows/task_execution/transition.py:21
- Draft comment:
The match-case statement for settingstate.type
can be simplified. Consider using a more concise conditional approach.
if context.is_last_step:
state.type = "finish" if context.cursor.workflow == "main" else "finish_branch"
else:
state.type = "step"
- Reason this comment was not posted:
Confidence changes required:50%
Thetransition
function intransition.py
uses a match-case statement that could be simplified. The match-case is used to determine the type of transition based on the context, but it could be more concise by directly setting the state type based on conditions.
3. agents-api/agents_api/models/execution/create_temporal_lookup.py:38
- Draft comment:
ConvertingUUID
tostr
fordeveloper_id
andexecution_id
may be redundant if these values are already strings or if the function can handleUUID
types directly. Consider removing unnecessary conversions. - Reason this comment was not posted:
Confidence changes required:40%
Thecreate_temporal_lookup
function increate_temporal_lookup.py
has a redundant conversion ofUUID
tostr
fordeveloper_id
andexecution_id
. This conversion is unnecessary if these values are already strings or if the function that uses them can handleUUID
types.
Workflow ID: wflow_aRcH7zdrWaH109pL
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
@beartype | ||
async def set_value_step( | ||
context: StepContext, | ||
additional_values: dict[str, Any] = {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using mutable default arguments like {}
for additional_values
can lead to unexpected behavior. Consider using None
as the default value and initializing it inside the function.
additional_values: dict[str, Any] = {}, | |
additional_values: dict[str, Any] = None, |
agents-api/agents_api/routers/tasks/stream_transitions_events.py
Outdated
Show resolved
Hide resolved
ed4d2ec
to
ab427f0
Compare
Signed-off-by: Diwank Singh Tomer <[email protected]>
ab427f0
to
93b4bb1
Compare
There was a problem hiding this 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 ab427f0 in 44 seconds
More details
- Looked at
436
lines of code in11
files - Skipped
0
files when reviewing. - Skipped posting
5
drafted comments based on config settings.
1. agents-api/agents_api/clients/temporal.py:61
- Draft comment:
Consider adding type hints for the parameters and return type of this function for better readability and maintainability. - Reason this comment was not posted:
Confidence changes required:50%
Theget_workflow_handle
function intemporal.py
is missing type hints for its parameters and return type. Adding these will improve code readability and maintainability.
2. agents-api/agents_api/models/execution/create_temporal_lookup.py:32
- Draft comment:
Ensure that the@cozo_query
decorator is properly defined and imported, as it is not shown in the provided code. This might lead to runtime errors if not handled correctly. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The comment is speculative and not directly related to any changes made in the diff. It suggests verifying something that is not part of the code changes, which violates the rules for review comments. The decorator's presence in the unchanged code indicates it is likely already handled.
I might be overlooking the possibility that the decorator could be incorrectly defined elsewhere, but that is outside the scope of this diff review.
The focus should remain on the changes made in the diff, and the comment does not address any of those changes.
The comment should be deleted as it is speculative and not related to the changes made in the diff.
3. agents-api/agents_api/models/execution/lookup_temporal_data.py:30
- Draft comment:
Ensure that the@cozo_query
decorator is properly defined and imported, as it is not shown in the provided code. This might lead to runtime errors if not handled correctly. - Reason this comment was not posted:
Marked as duplicate.
4. agents-api/agents_api/routers/tasks/create_task_execution.py:124
- Draft comment:
Consider catching more specific exceptions instead of a generalException
to avoid masking unexpected errors. - Reason this comment was not posted:
Confidence changes required:50%
Thecreate_task_execution
function increate_task_execution.py
has a try-except block that catches a generalException
. It's a good practice to catch more specific exceptions to avoid masking unexpected errors.
5. agents-api/agents_api/routers/tasks/stream_transitions_events.py:100
- Draft comment:
Ensure thatnext_page_token
is always a valid base64 string to prevent runtime errors during decoding. - Reason this comment was not posted:
Confidence changes required:50%
Thestream_transitions_events
function instream_transitions_events.py
uses anext_page_token
parameter that is base64 decoded. Ensure that the input is always a valid base64 string to prevent runtime errors.
Workflow ID: wflow_FWNS6DmNCkI0GVg3
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
There was a problem hiding this 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 93b4bb1 in 33 seconds
More details
- Looked at
436
lines of code in11
files - Skipped
0
files when reviewing. - Skipped posting
5
drafted comments based on config settings.
1. agents-api/agents_api/routers/tasks/stream_transitions_events.py:1
- Draft comment:
Thetest_set_get_workflow.py
file is empty and should be removed if not needed. - Reason this comment was not posted:
Confidence changes required:50%
Thetest_set_get_workflow.py
file is empty and should be removed if not needed.
2. agents-api/agents_api/models/execution/create_temporal_lookup.py:2
- Draft comment:
Theuuid4
import is unused and should be removed. - Reason this comment was not posted:
Confidence changes required:50%
Thecreate_temporal_lookup
function has an unused importuuid4
which should be removed.
3. agents-api/agents_api/models/execution/create_temporal_lookup.py:1
- Draft comment:
TheTypeVar
import is unused and should be removed. - Reason this comment was not posted:
Confidence changes required:50%
Thecreate_temporal_lookup
function has an unused importTypeVar
which should be removed.
4. agents-api/agents_api/models/execution/lookup_temporal_data.py:1
- Draft comment:
TheAny
import is unused and should be removed. - Reason this comment was not posted:
Confidence changes required:50%
Thelookup_temporal_data
function has an unused importAny
which should be removed.
5. agents-api/agents_api/models/execution/lookup_temporal_data.py:18
- Draft comment:
TheModelT
import is unused and should be removed. - Reason this comment was not posted:
Confidence changes required:50%
Thelookup_temporal_data
function has an unused importModelT
which should be removed.
Workflow ID: wflow_HdQm5nWXvqbSAoVW
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
Summary:
This PR adds a Transitions stream SSE endpoint, implements set/get steps in workflows, updates temporal data handling, and modifies the TypeScript SDK and tests.
Key points:
agents-api/agents_api/routers/tasks/stream_transitions_events.py
.agents-api/agents_api/workflows/task_execution/__init__.py
.lookup_temporal_data
inagents-api/agents_api/models/execution/lookup_temporal_data.py
.create_temporal_lookup
to use execution ID inagents-api/agents_api/models/execution/create_temporal_lookup.py
.set_value_step
for setting values in workflows.TaskExecutionWorkflow
to handleSetStep
andGetStep
.SetStep
.agents-api/tests/test_execution_queries.py
.Generated with ❤️ by ellipsis.dev