Skip to content

About

No description or website provided.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Agentic Document Analysis

A minimal AI engineering project demonstrating how modern LLM applications interact with tools, APIs and external systems.

The goal is not to build an autonomous AI agent, but to demonstrate practical implementation of:

  • OpenAI API integration
  • Tool Calling
  • MCP (Model Context Protocol)
  • Structured Outputs
  • FastAPI services
  • Observability and tracing
  • Evaluation and testing
  • Cost monitoring

The project focuses on engineering practices commonly used in production AI systems.


Business Problem

Organizations process large volumes of reports, filings and technical documents.

Manual analysis is time-consuming and often repetitive.

This project demonstrates how an LLM-powered service can assist analysts by:

  • classifying documents
  • generating executive summaries
  • extracting key entities
  • identifying important topics
  • exposing processing steps through traces and metrics

The objective is to create a transparent and observable AI workflow rather than a fully autonomous decision-making system.


Scope

Minimal Proof of Understanding.

The project prioritizes architectural clarity and demonstrable AI engineering skills over product completeness.

In scope:

  • document ingestion
  • OpenAI integration
  • MCP-based tool usage
  • structured outputs
  • tracing and observability
  • cost tracking
  • automated tests

Out of scope:

  • user authentication
  • frontend development
  • multi-tenancy
  • production deployment
  • autonomous agent swarms
  • custom model training

Data Sources

Source URL Purpose
SEC EDGAR Filings https://www.sec.gov/edgar/search/ Financial reports
ECB Publications https://www.ecb.europa.eu/pub/html/index.en.html Central bank reports
OECD Reports https://www.oecd.org/publications/ Policy documents
World Bank Documents https://documents.worldbank.org/ Long-form reports
arXiv Papers https://arxiv.org/ Technical documents

Functional Requirements

ID Requirement
FR-1 Upload document
FR-2 Classify document type
FR-3 Generate executive summary
FR-4 Extract entities
FR-5 Generate risk assessment
FR-6 Generate action items
FR-7 Return structured JSON output
FR-8 Expose tool execution trace
FR-9 Support MCP tool discovery
FR-10 Record token and cost statistics

Non Functional Requirements

ID Requirement Target
NFR-1 Response latency <15 sec
NFR-2 Structured output validity 100%
NFR-3 Dockerized deployment Required
NFR-4 Observability LangSmith traces
NFR-5 Type safety Pydantic models
NFR-6 Cost visibility Per-request statistics
NFR-7 Tool reliability >95% successful calls

User Stories

ID User Story
US-1 As an analyst, I want a summary so that I can understand the document quickly
US-2 As a manager, I want action items so that I know what decisions are required
US-3 As an auditor, I want execution traces so that I can understand how the result was produced
US-4 As an engineer, I want tool metrics so that I can evaluate system performance
US-5 As an AI engineer I want MCP-based tools so that I can experiment with modern agent architectures

Test Cases

ID Test Case Expected Result
TC-1 Financial report upload Classification succeeds
TC-2 Entity extraction Known entities identified
TC-3 Summary generation Non-empty summary returned
TC-4 Risk assessment Risks detected when present
TC-5 JSON validation Schema passes
TC-6 MCP tool invocation Tool executes successfully
TC-7 Cost tracking Token usage recorded
TC-8 Trace generation LangSmith trace available

Definition of Done

ID Deliverable
DOD-1 FastAPI service operational
DOD-2 OpenAI integration completed
DOD-3 MCP client implemented
DOD-4 At least 3 MCP tools implemented
DOD-5 Structured outputs implemented
DOD-6 LangSmith tracing enabled
DOD-7 Docker image created
DOD-8 CI pipeline configured
DOD-9 Cost tracking implemented
DOD-10 README completed

Architectural Decisions

Decision Chosen Alternative Reason
LLM OpenAI GPT-4.1 Local Llama Focus on application engineering rather than GPU optimization
Vector DB Qdrant Pinecone Open source and reproducible, easy local setup, sufficient for portfolio purposes
Framework FastAPI Flask Strong typing and OpenAPI support
Data Engine Polars Pandas Better scalability

Architecture Features Checklist

LLM

  • OpenAI API
  • Structured Outputs
  • Tool Calling

MCP

  • MCP Client
  • Tool Discovery
  • Custom MCP Server
  • FastAPI Integration

Backend

  • FastAPI
  • Pydantic
  • SQLAlchemy

Observability

  • LangSmith
  • Request Tracing
  • Cost Tracking

Engineering

  • Docker
  • GitHub Actions
  • Unit Tests
  • Integration Tests

Security

  • Prompt Injection Protection
  • Input Validation
  • Rate Limiting

Feature Checklist

Agent Engineering

  • LangGraph
  • Tool calling
  • State management
  • Multi-step workflow

LLM

  • OpenAI
  • Structured outputs
  • Prompt templates

Backend

  • FastAPI
  • Pydantic

Evaluation

  • LangSmith
  • Golden dataset

Security

  • Input sanitization
  • Prompt injection checks

Cost

  • Token accounting
  • Cost reporting

About

No description or website provided.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors