Skip to content

Feature: Agentic AI Workflows for Document Analysis & Automation #24

Description

@hoangsonww

Summary

Introduce agentic AI capabilities into DocuThinker so the system can autonomously plan, decide, and execute multi-step tasks on uploaded documents. Instead of only responding to direct user queries, the AI will act as an agent that can break down objectives into sub-tasks (summarization, classification, recommendations, external API queries), execute them, and present structured outcomes.

Problem / Motivation

Currently, DocuThinker processes documents in a single-pass request-response mode (summarization, insights, chat). However:

  • Users often need chained workflows (e.g., “Summarize this document, extract actions, send recommendations via email”).
  • Complex document sets require multi-step reasoning (e.g., compare insights across multiple PDFs and produce a prioritized report).
  • Without agentic planning, the system is reactive instead of proactive.

Adding agentic AI will allow DocuThinker to:

  • Autonomously select the right tools (NER, sentiment, summarizer, recommendations).
  • Orchestrate multiple steps into workflows.
  • Adapt its behavior to user goals instead of static prompts.

Proposed Solution

  • Integrate a LangChain-style Agent Executor with access to DocuThinker’s internal tools:

    • Summarizer
    • Sentiment Analyzer
    • Document Classifier
    • Recommendations Generator
    • External APIs (GraphQL, REST endpoints)
  • Define an Agent Orchestrator Service in backend/ai_ml/agent_executor.js.

  • Extend /chat API with an option:

    {
      "query": "Analyze all uploaded documents and generate a decision brief with action items.",
      "mode": "agentic"
    }
  • Add a UI workflow visualization (step-by-step execution trace).


Architecture

flowchart TD
    User[User Request] --> Intent[Intent Recognition]
    Intent --> AgentPlanner[Agent Planner]
    AgentPlanner -->|Chooses Tool| ToolSummarizer[Summarizer]
    AgentPlanner -->|Chooses Tool| ToolSentiment[Sentiment Analyzer]
    AgentPlanner -->|Chooses Tool| ToolNER[NER & POS Extractor]
    AgentPlanner -->|Chooses Tool| ToolRecommend[Actionable Recs]
    ToolSummarizer --> Memory[Agent Memory]
    ToolSentiment --> Memory
    ToolNER --> Memory
    ToolRecommend --> Memory
    Memory --> Report[Final Structured Response]
    Report --> User
Loading
  • Agent Planner: Decides which tools to call and in what order.
  • Agent Memory: Maintains context across steps (persistent history).
  • Report Generator: Produces final outputs (summary + recs + actions).

Acceptance Criteria

  • User can select mode=agentic when uploading documents or chatting.
  • AI automatically sequences tasks (summarize → extract actions → recommend).
  • Execution trace (tools used, steps taken) is visible in UI for transparency.
  • Works with multiple documents (cross-doc comparison).
  • Agent memory persists within a session for multi-step reasoning.

Benefits

  • Enables autonomous workflows beyond simple Q&A.
  • Adds multi-document intelligence (cross-analysis, comparisons).
  • Makes DocuThinker more proactive and adaptive.
  • Differentiates it from standard summarization/chat apps.

Next Steps

  1. Prototype an Agent Orchestrator using LangChain’s initialize_agent with custom tools.
  2. Extend backend /chat to support mode=agentic.
  3. Add frontend UI component for execution trace visualization.
  4. Benchmark with real-world workflows (e.g., meeting notes → action plan).

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdocumentationImprovements or additions to documentationenhancementNew feature or requestgood first issueGood for newcomershelp wantedExtra attention is neededquestionFurther information is requested

Projects

Status
Backlog

Relationships

None yet

Development

No branches or pull requests

Issue actions