# shubbham28/financial-agent architecture

> Architecture diagram of the GitHub repository shubbham28/financial-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shubbham28/financial-agent
- Repository: https://github.com/shubbham28/financial-agent

## Overview

##### Main Components to Highlight
- App Layer (app.py): Acts as the entry point and interface for the agent.
- Agent Kernel (agent_kernel.py): The core engine that orchestrates the LLM-driven analysis and integrates skills.
- Skills Module: Contains distinct skill components (financial_skill.py, sentiment_skill.py, summary_skill.py) that perform specialized analysis.
- Configuration Files (config directory): Holds model configurations and prompt templates (model_config.yaml, prompt_templates.yaml) which define the behavior and parameters for the agent.
- Testing/Experimentation: The notebook files (financial_agent_test.ipynb) indicate interactive or exploratory testing, though they might not be part of the real-time production flow.

##### Relationships and Interactions
- The App (app.py) initiates requests, calling the Agent Kernel.
- The Agent Kernel (agent_kernel.py) processes the input, sends configuration data from the YAML files to set up the model parameters and prompt templates, and then engages with various skills.
- Each Skill is a modular component that implements a specific capability (e.g., performing financial calculations, gauging sentiment, summarizing data). They interact with the Kernel through well-defined interfaces or function calls.
- Data Flow: The incoming user request flows from the App Layer to the Core Kernel; the Kernel then dispatches parts of the task to the relevant Skill modules and aggregates their outputs for a final response.

##### Architectural Patterns and Design Principles
- Modular Design: The separation into an App, Kernel, and Skills promotes high cohesion within modules and low coupling between them.
- Configuration-Driven Behavior: Use of YAML files for model and prompt settings suggests a flexible design where behavior can be modified without code changes.
- Extensibility: By organizing individual analysis functionalities as separate skills, it is easy to add or modify components as needed.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Top Layer - App
    A["App Layer (app.py)"]:::app

    %% Middle Layer - Core Engine and Configurations
    K["Agent Kernel (agent_kernel.py)"]:::kernel
    C["Configurations"]:::config

    %% Bottom Layer - Skills Modules
    subgraph "Skills Modules"
        FS["Financial Skill"]:::skill
        SS["Sentiment Skill"]:::skill
        SumS["Summary Skill"]:::skill
    end

    %% Testing node (optional)
    T["Test Notebook (financial_agent_test.ipynb)"]:::test

    %% Connections
    A -->|"calls"| K
    K -->|"loads"| C
    K -->|"dispatches"| FS
    K -->|"dispatches"| SS
    K -->|"dispatches"| SumS
    FS -->|"returns"| K
    SS -->|"returns"| K
    SumS -->|"returns"| K
    T -->|"tests"| K

    %% Click Events
    click A "https://github.com/shubbham28/financial-agent/blob/main/app.py"
    click K "https://github.com/shubbham28/financial-agent/blob/main/agent_kernel.py"
    click FS "https://github.com/shubbham28/financial-agent/blob/main/skills/financial_skill.py"
    click SS "https://github.com/shubbham28/financial-agent/blob/main/skills/sentiment_skill.py"
    click SumS "https://github.com/shubbham28/financial-agent/blob/main/skills/summary_skill.py"
    click C "https://github.com/shubbham28/financial-agent/tree/main/config/"
    click T "https://github.com/shubbham28/financial-agent/blob/main/financial_agent_test.ipynb"

    %% Styles
    classDef app fill:#a2d9ce,stroke:#000,stroke-width:1px;
    classDef kernel fill:#f9e79f,stroke:#000,stroke-width:1px;
    classDef config fill:#d6eaf8,stroke:#000,stroke-width:1px;
    classDef skill fill:#d5f5e3,stroke:#000,stroke-width:1px;
    classDef test fill:#f5b7b1,stroke:#000,stroke-width:1px;
```
