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

Add step / task / workflow run / observer metrics as logs #1691

Closed
wants to merge 1 commit into from

Conversation

wintonzheng
Copy link
Contributor

@wintonzheng wintonzheng commented Jan 31, 2025

Important

Add logging for step, task, workflow run, and observer metrics, and enhance LLM API calls with prompt_name for better tracking.

  • Metrics Logging:
    • Log step duration in update_step() in agent.py when step is completed or failed.
    • Log task duration in update_task() in agent.py when task is completed, failed, or terminated.
    • Log observer cruise duration in mark_observer_task_as_completed() in observer_service.py when completed.
    • Log workflow run duration in execute_workflow() in service.py when completed.
  • LLM API Enhancements:
    • Add prompt_name parameter to LLM API calls in agent.py, agent_functions.py, api_handler_factory.py, agent_protocol.py, totp.py, observer_service.py, block.py, caching.py, handler.py for better tracking.
  • Miscellaneous:
    • Import UTC from datetime in agent.py and observer_service.py.

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

<!-- ELLIPSIS_HIDDEN -->

> [!IMPORTANT]
> Add logging for step, task, workflow run, and observer metrics, and introduce `prompt_name` parameter for LLM API calls.
>
>   - **Logging Enhancements**:
>     - Add logging for step duration in `update_step()` in `agent.py`.
>     - Add logging for task duration in `update_task()` in `agent.py`.
>     - Add logging for workflow run duration in `execute_workflow()` in `service.py`.
>     - Add logging for observer cruise duration in `mark_observer_task_as_completed()` in `observer_service.py`.
>     - Add logging for LLM API handler duration in `llm_api_handler_with_router_and_fallback()` and `llm_api_handler()` in `api_handler_factory.py`.
>   - **LLM API Changes**:
>     - Add `prompt_name` parameter to LLM API calls in `api_handler_factory.py` and various other files for better tracking.
>     - Update LLM API calls in `action_click.py`, `action_complete.py`, `action_input.py`, `agent.py`, `agent_functions.py`, `agent_protocol.py`, `totp.py`, `observer_service.py`, `block.py`, `service.py`, `caching.py`, `handler.py`, and `test_prompts.py` to include `prompt_name`.
>   - **Miscellaneous**:
>     - Set `include_in_schema=False` for `eval_router` in `app.py` to exclude it from the schema.
>
> <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=Skyvern-AI%2Fskyvern-cloud&utm_source=github&utm_medium=referral)<sup> for 1645c7ad2ac1b6ddb4ae7f835e1e278503afa5ac. It will automatically update as commits are pushed.</sup>

<!-- ELLIPSIS_HIDDEN -->
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 a27f64f in 46 seconds

More details
  • Looked at 554 lines of code in 11 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. skyvern/forge/sdk/workflow/service.py:472
  • Draft comment:
    Ensure that the prompt_name parameter is consistently passed to the LLM_API_HANDLER calls to maintain consistency in logging and tracking. This is missing in some instances.
  • Reason this comment was not posted:
    Comment did not seem useful.

Workflow ID: wflow_WJ76D52d3T5bcwxE


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! Reviewed everything up to a27f64f in 1 minute and 22 seconds

More details
  • Looked at 554 lines of code in 11 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. skyvern/forge/sdk/workflow/service.py:473
  • Draft comment:
    Ensure that the prompt_name parameter is consistently passed to all LLM_API_HANDLER calls for consistent logging and tracking. This is missing in some instances.
  • Reason this comment was not posted:
    Comment did not seem useful.

Workflow ID: wflow_agxSI5SAD09H68us


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

@suchintan suchintan closed this Feb 1, 2025
@suchintan suchintan deleted the suchintan.add-metrics-as-logs branch February 1, 2025 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants