# vimal-sabari/agentic-ai---based-livestock-farm-management architecture

> Architecture diagram of the GitHub repository vimal-sabari/agentic-ai---based-livestock-farm-management, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vimal-sabari/agentic-ai---based-livestock-farm-management
- Repository: https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management

## Overview

This repository implements a dairy-cow monitoring dashboard and a goal-directed multi-agent investigation workflow. Users select a specialist view or submit a cow and time window to the multi-agent system; the lead health agent detects baseline deviations, the orchestration graph dispatches specialist inquiries, and the dashboard presents findings and evidence. The major domain branches cover environment and welfare, feeding and nutrition, and milk production. Relationships for unsampled subsystems are included only where the README or SOURCE INDEX documents them; those excerpts do not establish every internal call.

Main entry points: [`src/orchestration/graph.py`](https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/src/orchestration/graph.py) (LangGraph Workflow), [`src/agents/health_behavior.py`](https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/src/agents/health_behavior.py) (Health Lead Agent), [`src/data/repository.py`](https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/src/data/repository.py) (Livestock Repository), [`src/ui/views/multi_agent_view.py`](https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/src/ui/views/multi_agent_view.py) (Multi-Agent View)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Dashboard"]
  node_launcher["App Navigation<br/>[app.py]"]
  node_multi_view["Multi-Agent View"]
  node_specialist_views["Specialist Views"]
  node_ui_components["Result Components<br/>[components.py]"]
end

subgraph group_shared["Shared Data"]
  node_models["Request Contracts<br/>[models.py]"]
  node_canonical["Canonical Schema<br/>[schema.py]"]
  node_adapter["Dataset Adapter<br/>[adapter.py]"]
  node_synthetic["Synthetic Data"]
  node_repository[("Livestock Repository<br/>[repository.py]")]
end

subgraph group_coordination["Investigation"]
  node_graph["LangGraph Workflow<br/>[graph.py]"]
  node_state["Investigation State<br/>[state.py]"]
end

subgraph group_specialists["Specialists"]
  node_health["Health Lead Agent<br/>[health_behavior.py]"]
  node_env_wrapper["Environment Adapter"]
  node_env_agent["Environment Specialist<br/>[agent.py]"]
  node_feeding["Feeding Specialist<br/>[agent.py]"]
  node_production["Production Specialist<br/>[agent.py]"]
end

subgraph group_analysis["Domain Analysis"]
  node_health_analysis["Anomaly Detection<br/>[anomaly.py]"]
  node_health_queries["Specialist Query Builder<br/>[query_builder.py]"]
  node_health_synthesis["Evidence Synthesis<br/>[synthesis.py]"]
  node_env_support["Environment Analysis"]
  node_feeding_support["Feeding Analysis"]
  node_production_support["Production Analysis"]
end

node_user(("Dashboard User"))

node_user -->|"selects view"| node_launcher
node_launcher -->|"routes to"| node_multi_view
node_launcher -->|"routes to"| node_specialist_views
node_multi_view -->|"runs inquiry"| node_graph
node_multi_view -->|"loads data"| node_repository
node_specialist_views -->|"loads data"| node_repository
node_specialist_views -->|"renders results"| node_ui_components
node_repository -->|"generates missing data"| node_synthetic
node_repository -->|"adapts raw data"| node_adapter
node_adapter -->|"maps columns"| node_canonical
node_graph -->|"starts investigation"| node_health
node_graph -->|"dispatches inquiry"| node_env_wrapper
node_graph -.->|"dispatches inquiry"| node_feeding
node_graph -.->|"dispatches inquiry"| node_production
node_graph -->|"tracks workflow"| node_state
node_health -->|"detects deviations"| node_health_analysis
node_health -->|"builds inquiries"| node_health_queries
node_health -.->|"synthesizes evidence"| node_health_synthesis
node_health -->|"queries timelines"| node_repository
node_env_wrapper -->|"delegates queries"| node_env_agent
node_env_agent -->|"analyzes conditions"| node_env_support
node_feeding -->|"analyzes feeding"| node_feeding_support
node_production -->|"analyzes production"| node_production_support
node_health -->|"uses contracts"| node_models
node_graph -->|"exchanges requests"| node_models
node_multi_view -->|"renders findings"| node_ui_components

click node_launcher "https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/app.py"
click node_multi_view "https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/src/ui/views/multi_agent_view.py"
click node_specialist_views "https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/tree/main/src/ui/views"
click node_ui_components "https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/src/ui/components.py"
click node_models "https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/src/core/models.py"
click node_canonical "https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/src/data/schema.py"
click node_adapter "https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/src/data/adapter.py"
click node_synthetic "https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/src/data/synthetic_generator.py"
click node_repository "https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/src/data/repository.py"
click node_graph "https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/src/orchestration/graph.py"
click node_state "https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/src/orchestration/state.py"
click node_health "https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/src/agents/health_behavior.py"
click node_env_wrapper "https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/src/agents/environment_welfare.py"
click node_env_agent "https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/env_welfare_agent/src/env_agent/agent.py"
click node_feeding "https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/feeding_agent/src/feeding_agent/agent.py"
click node_production "https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/production_agent/src/production_agent/agent.py"
click node_health_analysis "https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/health_agent/src/health_agent/anomaly.py"
click node_health_queries "https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/health_agent/src/health_agent/query_builder.py"
click node_health_synthesis "https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/health_agent/src/health_agent/synthesis.py"
click node_env_support "https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/tree/main/env_welfare_agent/src/env_agent"
click node_feeding_support "https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/tree/main/feeding_agent/src/feeding_agent"
click node_production_support "https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/tree/main/production_agent/src/production_agent"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_launcher,node_multi_view,node_specialist_views,node_ui_components,node_user toneBlue
class node_models,node_canonical,node_adapter,node_synthetic,node_repository toneAmber
class node_graph,node_state toneMint
class node_health,node_env_wrapper,node_env_agent,node_feeding,node_production toneRose
class node_health_analysis,node_health_queries,node_health_synthesis,node_env_support,node_feeding_support,node_production_support toneIndigo
```

## Components

### Dashboard

- [App Navigation](https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/app.py): `app.py`
- [Multi-Agent View](https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/src/ui/views/multi_agent_view.py): `src/ui/views/multi_agent_view.py`
- [Specialist Views](https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/tree/main/src/ui/views): `src/ui/views`
- [Result Components](https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/src/ui/components.py): `src/ui/components.py`

### Shared Data

- [Request Contracts](https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/src/core/models.py): `src/core/models.py`
- [Canonical Schema](https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/src/data/schema.py): `src/data/schema.py`
- [Dataset Adapter](https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/src/data/adapter.py): `src/data/adapter.py`
- [Synthetic Data](https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/src/data/synthetic_generator.py): `src/data/synthetic_generator.py`
- [Livestock Repository](https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/src/data/repository.py): `src/data/repository.py`

### Investigation

- [LangGraph Workflow](https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/src/orchestration/graph.py): `src/orchestration/graph.py`
- [Investigation State](https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/src/orchestration/state.py): `src/orchestration/state.py`

### Specialists

- [Health Lead Agent](https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/src/agents/health_behavior.py): `src/agents/health_behavior.py`
- [Environment Adapter](https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/src/agents/environment_welfare.py): `src/agents/environment_welfare.py`
- [Environment Specialist](https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/env_welfare_agent/src/env_agent/agent.py): `env_welfare_agent/src/env_agent/agent.py`
- [Feeding Specialist](https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/feeding_agent/src/feeding_agent/agent.py): `feeding_agent/src/feeding_agent/agent.py`
- [Production Specialist](https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/production_agent/src/production_agent/agent.py): `production_agent/src/production_agent/agent.py`

### Domain Analysis

- [Anomaly Detection](https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/health_agent/src/health_agent/anomaly.py): `health_agent/src/health_agent/anomaly.py`
- [Specialist Query Builder](https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/health_agent/src/health_agent/query_builder.py): `health_agent/src/health_agent/query_builder.py`
- [Evidence Synthesis](https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/blob/main/health_agent/src/health_agent/synthesis.py): `health_agent/src/health_agent/synthesis.py`
- [Environment Analysis](https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/tree/main/env_welfare_agent/src/env_agent): `env_welfare_agent/src/env_agent`
- [Feeding Analysis](https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/tree/main/feeding_agent/src/feeding_agent): `feeding_agent/src/feeding_agent`
- [Production Analysis](https://github.com/vimal-sabari/agentic-ai---based-livestock-farm-management/tree/main/production_agent/src/production_agent): `production_agent/src/production_agent`

### Other components

- **Dashboard User**

## Connections

- Dashboard User → App Navigation: selects view (evidence: `app.py`)
- App Navigation → Multi-Agent View: routes to (evidence: `app.py`)
- App Navigation → Specialist Views: routes to (evidence: `app.py`)
- Multi-Agent View → LangGraph Workflow: runs inquiry (evidence: `src/ui/views/multi_agent_view.py`)
- Multi-Agent View → Livestock Repository: loads data (evidence: `src/ui/views/multi_agent_view.py`)
- Specialist Views → Livestock Repository: loads data (evidence: `src/ui/views/environment_view.py`)
- Specialist Views → Result Components: renders results (evidence: `src/ui/views/environment_view.py`)
- Livestock Repository → Synthetic Data: generates missing data (evidence: `src/data/repository.py`)
- Livestock Repository → Dataset Adapter: adapts raw data (evidence: `src/data/repository.py`)
- Dataset Adapter → Canonical Schema: maps columns (evidence: `src/data/adapter.py`)
- LangGraph Workflow → Health Lead Agent: starts investigation (evidence: `src/orchestration/graph.py`)
- LangGraph Workflow → Environment Adapter: dispatches inquiry (evidence: `src/orchestration/graph.py`)
- LangGraph Workflow → Feeding Specialist: dispatches inquiry
- LangGraph Workflow → Production Specialist: dispatches inquiry
- LangGraph Workflow → Investigation State: tracks workflow (evidence: `src/orchestration/graph.py`)
- Health Lead Agent → Anomaly Detection: detects deviations (evidence: `src/agents/health_behavior.py`)
- Health Lead Agent → Specialist Query Builder: builds inquiries (evidence: `src/agents/health_behavior.py`)
- Health Lead Agent → Evidence Synthesis: synthesizes evidence
- Health Lead Agent → Livestock Repository: queries timelines (evidence: `src/agents/health_behavior.py`)
- Environment Adapter → Environment Specialist: delegates queries (evidence: `src/agents/environment_welfare.py`)
- Environment Specialist → Environment Analysis: analyzes conditions (evidence: `env_welfare_agent/src/env_agent/agent.py`)
- Feeding Specialist → Feeding Analysis: analyzes feeding (evidence: `feeding_agent/src/feeding_agent/agent.py`)
- Production Specialist → Production Analysis: analyzes production (evidence: `production_agent/src/production_agent/agent.py`)
- Health Lead Agent → Request Contracts: uses contracts (evidence: `src/agents/health_behavior.py`)
- LangGraph Workflow → Request Contracts: exchanges requests (evidence: `src/orchestration/graph.py`)
- Multi-Agent View → Result Components: renders findings (evidence: `src/ui/views/multi_agent_view.py`)
