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: agent #1148

Merged
merged 29 commits into from
Dec 12, 2024
Merged

feat: agent #1148

merged 29 commits into from
Dec 12, 2024

Conversation

atarashansky
Copy link
Contributor

@atarashansky atarashansky commented Dec 12, 2024

PR Description

Summary

This PR introduces a new "Agent Component" to the frontend and corresponding backend support for managing AI-assisted workflows within the application. The implementation enables users to interact with an agent for automated actions, visualizations, and insights, specifically tailored to single-cell data analysis and visualization tasks.

Changes in This PR

1. Frontend Enhancements:

  • New AgentComponent for user interaction:
    • Implemented a draggable and resizable UI component using react-draggable and re-resizable.
    • Integrated ReactMarkdown for rendering markdown-based responses.
    • Enabled chat history management and message editing features.
  • Redux Action:
    • Added a Redux action for reverting application state to a specific action count.
  • App Modifications:
    • Modified App to display the agent component conditionally based on a feature flag.
  • Dependencies:
    • Updated package dependencies:
      • Added react-markdown, re-resizable, react-draggable, and zod.

2. Backend Integration:

  • AI Agent Endpoint:
    • Introduced an AI agent endpoint (/agent/step) in the Flask API:
      • Handles multi-step agent workflows using the langchain library.
      • Supports dynamic tool invocation for dataset-specific operations.
  • Tool System:
    • Added a modular tool system in server.common.tools:
      • Tools include subsetting, categorical selection, coloring, histogram selection, and more.
  • OpenAI Integration:
    • Implemented a structured OpenAI API integration for agent response generation.

3. New Features and Functionality:

  • Undoable State Enhancements:
    • Added a new revert-to-action action type for undoable state management.
  • Agent-Specific Redux Actions:
    • Introduced actions for categorical and continuous data selections.
  • Enhanced Metadata Handling:
    • Improved schema parsing for agent operations.

4. Technical Improvements:

  • Refactored and extended existing Redux reducers to accommodate agent-specific states.

5. Developer Dependencies:

  • Added langchain, langchain-openai, and related libraries for structured agent workflows.
  • Updated pydantic to version 2.x for enhanced model validation.

Usage

  • Users can interact with the agent via the UI to perform tasks like subsetting, coloring, or visualizing data points.
  • Developers can extend the toolset or modify agent behavior by adding new tools or updating the system prompt.

Testing

  • Manual testing for agent workflows, tool integration, and UI interactions.
  • Verified compatibility with existing app features and ensured no regressions.

Next Steps

  • Add unit tests for backend API integration and tools.
  • Enhance UI accessibility and error handling for agent interactions.

Known Issues

  • Limited test coverage for new agent workflows.
  • Further optimization needed for large dataset interactions.
  • Summarization step sometimes includes already-summarized actions in the summary.

@atarashansky atarashansky marked this pull request as ready for review December 12, 2024 17:44
@kaloster kaloster added the stack label Dec 12, 2024
@atarashansky atarashansky merged commit 6d162bf into main Dec 12, 2024
16 of 17 checks passed
@atarashansky atarashansky deleted the atar-agent branch December 12, 2024 23:19
tihuan added a commit that referenced this pull request Dec 18, 2024
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.

3 participants