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

fix(agents-api): Fix task execution logic #473

Merged
merged 2 commits into from
Aug 29, 2024

Conversation

creatorrr
Copy link
Contributor

@creatorrr creatorrr commented Aug 29, 2024

  • fix(agents-api): Fix prompt step
  • fix(agents-api): Fix task execution logic

🚀 This description was created by Ellipsis for commit 00389b4

Summary:

This PR refines task execution logic in the agents-api by adding a new query step, refactoring prompt handling, updating transition logic, and enhancing error handling across multiple files.

Key points:

  • Added cozo_query_step to agents-api/agents_api/activities/task_steps/__init__.py.
  • Implemented cozo_query_step in agents-api/agents_api/activities/task_steps/cozo_query_step.py for executing queries.
  • Refactored prompt_step in agents-api/agents_api/activities/task_steps/prompt_step.py to simplify prompt handling and settings application.
  • Updated transition_step in agents-api/agents_api/activities/task_steps/transition_step.py to use execution_input for IDs.
  • Modified acompletion in agents-api/agents_api/clients/litellm.py to filter supported parameters and format model names.
  • Added finish to valid transitions in agents-api/agents_api/common/protocol/tasks.py.
  • Adjusted developer ID handling in agents-api/agents_api/dependencies/developer_id.py for multi-tenant mode.
  • Fixed transition query in agents-api/agents_api/models/execution/create_execution_transition.py to include execution_id.
  • Enhanced error handling in agents-api/agents_api/routers/tasks/get_execution_details.py by printing exceptions.
  • Refined task execution logic in agents-api/agents_api/workflows/task_execution.py to handle errors and transitions.
  • Added a sample task simple_prompt.yaml in agents-api/tests/sample_tasks/ for testing.

Generated with ❤️ by ellipsis.dev

Diwank Tomer added 2 commits August 28, 2024 19:02
Signed-off-by: Diwank Tomer <diwank@julep.ai>
Signed-off-by: Diwank Tomer <diwank@julep.ai>
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 00389b4 in 26 seconds

More details
  • Looked at 468 lines of code in 12 files
  • Skipped 0 files when reviewing.
  • Skipped posting 7 drafted comments based on config settings.
1. agents-api/agents_api/activities/task_steps/__init__.py:4
  • Draft comment:
    The cozo_query_step is imported but not used anywhere else in the codebase. Ensure this is intentional or remove the unused import.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The import statement for 'cozo_query_step' was added, but the file 'cozo_query_step.py' is new and not used anywhere else in the codebase. This might be an oversight or a preparation for future use.
2. agents-api/agents_api/activities/task_steps/cozo_query_step.py:17
  • Draft comment:
    Consider adding error handling for getattr to handle cases where module_name or name do not exist in models.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The function cozo_query_step uses getattr to dynamically access attributes from the models module. This can lead to runtime errors if the attributes do not exist. Consider adding error handling for this.
3. agents-api/agents_api/activities/task_steps/prompt_step.py:76
  • Draft comment:
    Ensure that the key 'messages' or 'prompt' in completion_data matches the expected parameters of acompletion.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    In prompt_step, the acompletion function is called with completion_data which includes a key that is conditionally either 'messages' or 'prompt'. This should be consistent with the expected parameters of acompletion.
4. agents-api/agents_api/activities/task_steps/transition_step.py:25
  • Draft comment:
    If create_execution_transition_query returns important data or has side effects, consider handling its return value appropriately.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    In transition_step, the create_execution_transition_query function is called but the return value is not used. If this function has side effects or returns important data, consider handling it appropriately.
5. agents-api/agents_api/clients/litellm.py:19
  • Draft comment:
    Ensure model does not already contain the 'openai/' prefix before adding it to avoid incorrect model names.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    In acompletion, the model parameter is prefixed with 'openai/' but there is no check if it already contains this prefix. This could lead to incorrect model names if the prefix is already present.
6. agents-api/agents_api/routers/tasks/get_execution_details.py:19
  • Draft comment:
    Consider using a logging framework instead of print for error messages to improve error tracking and debugging.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    In get_execution_details, the error is printed but not logged. Consider using a logging framework for better error tracking and debugging.
7. agents-api/agents_api/workflows/task_execution.py:122
  • Draft comment:
    Ensure state is updated correctly between transition calls to reflect the current workflow state.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    In TaskExecutionWorkflow, the transition function is called multiple times but the state variable is not updated between calls. Ensure that state is correctly updated to reflect the current workflow state.

Workflow ID: wflow_aeBYjnWunMjFmqn1


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

@whiterabbit1983 whiterabbit1983 merged commit f62f46b into dev-tasks Aug 29, 2024
2 of 5 checks passed
@whiterabbit1983 whiterabbit1983 deleted the x/fix-task-execution branch August 29, 2024 13:17
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.

2 participants