Skip to content

P2.3: Develop Specialist & RAG Agents #29

@Virgo-Alpha

Description

@Virgo-Alpha

This is a major feature ticket that involves creating the next set of specialized "worker" agents and integrating them with Google Cloud Storage for document analysis. We will create two new agents: a FinancialBot and a powerful RAGSearchAgent for analyzing user-uploaded documents.

Implementation Tips

  1. FinancialBot - The Financial Analyst:
  • Creation: Use the Agent Starter Pack to create a new FinancialBot microservice.
  • Logic: This agent will be a "Formatter" similar to the JsonFormattingAgent. Its instruction prompt will be highly specialized, guiding it to find and extract key financial metrics (Revenue, Profit Margin, Burn Rate, etc.) from a block of unstructured text.
  • Schema: It will use a Pydantic output_schema to enforce a structured JSON output for the financial data it finds.
  • Tools: This agent will have no tools. Its sole job is to parse and structure text given to it.
  1. RAGSearchAgent - The Document Expert:
    This agent allows users to "chat with their documents." It uses a Retrieval-Augmented Generation (RAG) pipeline.
  • Prerequisite (F2.7 - GCS Integration): First, you must set up a Google Cloud Storage (GCS) bucket. When a user uploads a pitch deck, your Celery task will save this file to the GCS bucket.
  • Vertex AI RAG Corpus: In the Google Cloud Console, create a RAG Corpus in Vertex AI. Point this corpus to your GCS bucket. Vertex AI will automatically process and index the documents you upload, making them searchable.
  • Agent Creation: Create a new RAGSearchAgent using the Agent Starter Pack.
  • The RAG Tool: The agent's only tool will be the VertexAiRagRetrieval tool from the ADK. You will configure this tool with the ID of the RAG Corpus you created.
  • Agent Logic: The agent's instruction will be simple: "You are an expert at answering questions based only on the provided documents. Use the VertexAiRagRetrieval tool to find the answer to the user's question."

Acceptance Criteria (Checklist)

  • FinancialBot project is created and can be run locally.
  • RAGSearchAgent project is created and can be run locally.
  • A GCS bucket for document uploads is created.
  • A Vertex AI RAG Corpus is created and connected to the GCS bucket.
  • The RAGSearchAgent is configured with the correct Corpus ID in its environment.
  • Both new agents can be successfully called via an authenticated curl test after deployment.

Unit Tests

  • Local Agent Tests: Test each new agent locally within its own directory using make test.
  • FinancialBot Test: Write a pytest test that passes a sample block of financial text to the agent and asserts that the returned JSON contains the correct, extracted numerical values.
  • RAGSearchAgent Test: Write a test that mocks the VertexAiRagRetrieval tool. The test should call the agent with a question and assert that the mock tool was called with that exact question as the query.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions