cohere-toolkit icon indicating copy to clipboard operation
cohere-toolkit copied to clipboard

agents: track indexing tasks

Open mtanzim opened this issue 1 year ago • 1 comments

This PR introduces a new feature for agent task management and makes changes to the backend and frontend of the application.

Summary of Changes

  • Backend:
    • Added a new table, agent_tasks, to store agent tasks.
    • Introduced new functions, create_agent_task and get_agent_tasks_by_agent_id, for creating and retrieving agent tasks.
    • Modified the handle_google_drive_sync function to include an additional agent_id parameter.
    • Updated the functions create, delete, edit, move, rename, restore, and permission_change to include an agent_id parameter and added error handling.
    • Added a new MinimalBase class to the src/backend/database_models/base.py module.
    • Created a new AgentTaskResponse model to represent agent task responses.
    • Modified the Agent model to include a new agent_tasks attribute.
  • Frontend:
    • Added new components and hooks for displaying agent tasks, including a new page, src/interfaces/assistants_web/src/app/tasks/[agentId]/page.tsx, for viewing tasks and a right-panel link, src/interfaces/assistants_web/src/components/Agents/RightPanel.tsx, for accessing task dashboards.
    • Updated the AgentTaskResponse model to include additional properties.
    • Introduced a new useAgentTasks hook for fetching agent tasks.

mtanzim avatar Aug 15 '24 21:08 mtanzim

Codecov Report

Attention: Patch coverage is 50.70423% with 105 lines in your changes missing coverage. Please review.

Project coverage is 75.23%. Comparing base (95d5639) to head (a8cfea6).

Files Patch % Lines
.../backend/tools/google_drive/sync/actions/create.py 22.72% 17 Missing :warning:
...rc/backend/tools/google_drive/sync/actions/edit.py 27.77% 13 Missing :warning:
...rc/backend/tools/google_drive/sync/actions/move.py 27.77% 13 Missing :warning:
...ols/google_drive/sync/actions/permission_change.py 27.77% 13 Missing :warning:
.../backend/tools/google_drive/sync/actions/rename.py 31.25% 11 Missing :warning:
src/backend/services/agent.py 35.71% 9 Missing :warning:
src/backend/services/compass.py 22.22% 7 Missing :warning:
src/backend/crud/agent_task.py 62.50% 6 Missing :warning:
src/backend/tools/google_drive/sync/utils.py 53.84% 6 Missing :warning:
src/backend/alembic/env.py 25.00% 3 Missing :warning:
... and 3 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #676      +/-   ##
==========================================
- Coverage   75.50%   75.23%   -0.28%     
==========================================
  Files         263      265       +2     
  Lines       11728    11862     +134     
==========================================
+ Hits         8855     8924      +69     
- Misses       2873     2938      +65     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Aug 15 '24 21:08 codecov-commenter

Do we have a video of the UI changes and how they look? Just curious.

Also this current db design around AgentTask basically provides us with the lowest sync unit for an agent which is its file syncs. Have thoughts about how we should track general "agent syncs"? It would probably be a grouping of AgentTasks in a time period that we surface right? In that case how do we answer the question of "when was the agents last synced". Maybe that is not a question we care about answering and we care more about the files directly. Just thinking

giannis2two avatar Aug 22 '24 11:08 giannis2two

@giannis2two demo here https://cohereai.slack.com/archives/C075ZG5MX7Y/p1723842119080759

good points, i want to merge this PR first as it is just a foundational first draft. not actually a user feature quite yet. we can revisit the details of pagination and grouping of tasks after.

scott-cohere avatar Aug 22 '24 20:08 scott-cohere