# mohamedhishm/ai-agents-at-work architecture

> Architecture diagram of the GitHub repository mohamedhishm/ai-agents-at-work, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mohamedhishm/ai-agents-at-work
- Repository: https://github.com/mohamedhishm/ai-agents-at-work

## Overview

ELDOCTOR is a web-based operations agent for auto-parts businesses. A user signs in, sends a request through the frontend, and the FastAPI backend invokes the LangGraph agent; the agent uses customer/admin tools and JSON-backed business data to answer or manage an order. Order proposals require user confirmation before deterministic creation. The README also documents inventory summaries, low-stock checks, reorder drafts, order tracking, and role separation. The source index shows a second agent implementation under backend/agent; its relationship to the documented eldockor runtime is not established by the excerpts.

Main entry points: [`eldockor/graph.py`](https://github.com/mohamedhishm/ai-agents-at-work/blob/main/eldockor/graph.py) (Conversation workflow), [`backend/app/api/router.py`](https://github.com/mohamedhishm/ai-agents-at-work/blob/main/backend/app/api/router.py) (API routes), [`backend/agent/agent/graph.py`](https://github.com/mohamedhishm/ai-agents-at-work/blob/main/backend/agent/agent/graph.py) (Backend agent graph), [`frontend/app/dashboard/page.js`](https://github.com/mohamedhishm/ai-agents-at-work/blob/main/frontend/app/dashboard/page.js) (Operations UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web client"]
  node_frontend["Operations UI<br/>[page.js]"]
  node_chat["Chat interface<br/>[Chat.js]"]
  node_login["Login flow<br/>[page.js]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_api["Backend API"]
  node_backend["FastAPI app<br/>[main.py]"]
  node_routes["API routes<br/>[router.py]"]
  node_auth_service["Authentication<br/>[auth_service.py]"]
  node_agent_service["Agent service<br/>[agent_service.py]"]
  node_task_routes["Task routes<br/>[tasks.py]"]
  node_task_service["Task operations<br/>[task_service.py]"]
end

subgraph group_agent["Agent runtime"]
  node_agent_graph["Conversation workflow<br/>[graph.py]"]
  node_llm["LLM adapter<br/>[llm.py]"]
  node_prompts["Agent prompts<br/>[prompts.py]"]
  node_customer_tools["Customer tools<br/>[tools_customer.py]"]
  node_admin_tools["Admin tools<br/>[tools_admin.py]"]
  node_backend_graph["Backend agent graph<br/>[graph.py]"]
  node_backend_prompts["Backend prompts<br/>[prompts.py]"]
  node_backend_admin_tools["Backend admin tools<br/>[tools_admin.py]"]
end

subgraph group_data["Business data"]
  node_agent_store[("Agent FileStore<br/>[file_store.py]")]
  node_user_repo["User repository<br/>[user_repository.py]"]
  node_order_repo["Order repository"]
  node_json_file[("JSON file access<br/>[json_file.py]")]
  node_backend_store[("Backend FileStore<br/>[file_store.py]")]
end

node_customer(("Customer / admin"))

node_customer -->|"uses"| node_frontend
node_frontend -->|"requests API"| node_backend
node_chat -.->|"sends messages"| node_api_client
node_login -.->|"authenticates via"| node_api_client
node_backend -->|"mounts routes"| node_routes
node_routes -->|"routes agent requests"| node_agent_service
node_routes -.->|"routes authentication"| node_auth_service
node_routes -->|"includes"| node_task_routes
node_task_routes -->|"delegates tasks"| node_task_service
node_agent_service -->|"invokes agent"| node_agent_graph
node_agent_graph -->|"invokes model"| node_llm
node_agent_graph -->|"uses prompts"| node_prompts
node_agent_graph -->|"dispatches customer tools"| node_customer_tools
node_agent_graph -->|"dispatches admin tools"| node_admin_tools
node_agent_graph -->|"reads and writes"| node_agent_store
node_auth_service -->|"looks up users"| node_user_repo
node_task_service -->|"manages orders"| node_order_repo
node_user_repo -->|"reads and writes"| node_json_file
node_order_repo -->|"reads and writes"| node_json_file
node_backend_graph -->|"uses prompts"| node_backend_prompts
node_backend_graph -->|"uses admin tools"| node_backend_admin_tools
node_backend_graph -->|"uses store"| node_backend_store

click node_frontend "https://github.com/mohamedhishm/ai-agents-at-work/blob/main/frontend/app/dashboard/page.js"
click node_chat "https://github.com/mohamedhishm/ai-agents-at-work/blob/main/frontend/components/Chat.js"
click node_login "https://github.com/mohamedhishm/ai-agents-at-work/blob/main/frontend/app/login/page.js"
click node_api_client "https://github.com/mohamedhishm/ai-agents-at-work/blob/main/frontend/lib/api.js"
click node_backend "https://github.com/mohamedhishm/ai-agents-at-work/blob/main/backend/app/main.py"
click node_routes "https://github.com/mohamedhishm/ai-agents-at-work/blob/main/backend/app/api/router.py"
click node_auth_service "https://github.com/mohamedhishm/ai-agents-at-work/blob/main/backend/app/services/auth_service.py"
click node_agent_service "https://github.com/mohamedhishm/ai-agents-at-work/blob/main/backend/app/services/agent_service.py"
click node_task_routes "https://github.com/mohamedhishm/ai-agents-at-work/blob/main/backend/app/api/routes/tasks.py"
click node_task_service "https://github.com/mohamedhishm/ai-agents-at-work/blob/main/backend/app/services/task_service.py"
click node_agent_graph "https://github.com/mohamedhishm/ai-agents-at-work/blob/main/eldockor/graph.py"
click node_llm "https://github.com/mohamedhishm/ai-agents-at-work/blob/main/eldockor/llm.py"
click node_prompts "https://github.com/mohamedhishm/ai-agents-at-work/blob/main/eldockor/prompts.py"
click node_customer_tools "https://github.com/mohamedhishm/ai-agents-at-work/blob/main/eldockor/tools_customer.py"
click node_admin_tools "https://github.com/mohamedhishm/ai-agents-at-work/blob/main/eldockor/tools_admin.py"
click node_agent_store "https://github.com/mohamedhishm/ai-agents-at-work/blob/main/eldockor/store/file_store.py"
click node_user_repo "https://github.com/mohamedhishm/ai-agents-at-work/blob/main/backend/app/repositories/user_repository.py"
click node_order_repo "https://github.com/mohamedhishm/ai-agents-at-work/blob/main/backend/app/repositories/order_repository.py"
click node_json_file "https://github.com/mohamedhishm/ai-agents-at-work/blob/main/backend/app/repositories/json_file.py"
click node_backend_graph "https://github.com/mohamedhishm/ai-agents-at-work/blob/main/backend/agent/agent/graph.py"
click node_backend_prompts "https://github.com/mohamedhishm/ai-agents-at-work/blob/main/backend/agent/agent/prompts.py"
click node_backend_admin_tools "https://github.com/mohamedhishm/ai-agents-at-work/blob/main/backend/agent/agent/tools_admin.py"
click node_backend_store "https://github.com/mohamedhishm/ai-agents-at-work/blob/main/backend/agent/agent/store/file_store.py"

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_frontend,node_chat,node_login,node_api_client toneBlue
class node_backend,node_routes,node_auth_service,node_agent_service,node_task_routes,node_task_service toneAmber
class node_agent_graph,node_llm,node_prompts,node_customer_tools,node_admin_tools,node_backend_graph,node_backend_prompts,node_backend_admin_tools toneMint
class node_agent_store,node_user_repo,node_order_repo,node_json_file,node_backend_store toneRose
class node_customer toneIndigo
```

## Components

### Web client

- [Operations UI](https://github.com/mohamedhishm/ai-agents-at-work/blob/main/frontend/app/dashboard/page.js): `frontend/app/dashboard/page.js`
- [Chat interface](https://github.com/mohamedhishm/ai-agents-at-work/blob/main/frontend/components/Chat.js): `frontend/components/Chat.js`
- [Login flow](https://github.com/mohamedhishm/ai-agents-at-work/blob/main/frontend/app/login/page.js): `frontend/app/login/page.js`
- [API client](https://github.com/mohamedhishm/ai-agents-at-work/blob/main/frontend/lib/api.js): `frontend/lib/api.js`

### Backend API

- [FastAPI app](https://github.com/mohamedhishm/ai-agents-at-work/blob/main/backend/app/main.py): `backend/app/main.py`
- [API routes](https://github.com/mohamedhishm/ai-agents-at-work/blob/main/backend/app/api/router.py): `backend/app/api/router.py`
- [Authentication](https://github.com/mohamedhishm/ai-agents-at-work/blob/main/backend/app/services/auth_service.py): `backend/app/services/auth_service.py`
- [Agent service](https://github.com/mohamedhishm/ai-agents-at-work/blob/main/backend/app/services/agent_service.py): `backend/app/services/agent_service.py`
- [Task routes](https://github.com/mohamedhishm/ai-agents-at-work/blob/main/backend/app/api/routes/tasks.py): `backend/app/api/routes/tasks.py`
- [Task operations](https://github.com/mohamedhishm/ai-agents-at-work/blob/main/backend/app/services/task_service.py): `backend/app/services/task_service.py`

### Agent runtime

- [Conversation workflow](https://github.com/mohamedhishm/ai-agents-at-work/blob/main/eldockor/graph.py): `eldockor/graph.py`
- [LLM adapter](https://github.com/mohamedhishm/ai-agents-at-work/blob/main/eldockor/llm.py): `eldockor/llm.py`
- [Agent prompts](https://github.com/mohamedhishm/ai-agents-at-work/blob/main/eldockor/prompts.py): `eldockor/prompts.py`
- [Customer tools](https://github.com/mohamedhishm/ai-agents-at-work/blob/main/eldockor/tools_customer.py): `eldockor/tools_customer.py`
- [Admin tools](https://github.com/mohamedhishm/ai-agents-at-work/blob/main/eldockor/tools_admin.py): `eldockor/tools_admin.py`
- [Backend agent graph](https://github.com/mohamedhishm/ai-agents-at-work/blob/main/backend/agent/agent/graph.py): `backend/agent/agent/graph.py`
- [Backend prompts](https://github.com/mohamedhishm/ai-agents-at-work/blob/main/backend/agent/agent/prompts.py): `backend/agent/agent/prompts.py`
- [Backend admin tools](https://github.com/mohamedhishm/ai-agents-at-work/blob/main/backend/agent/agent/tools_admin.py): `backend/agent/agent/tools_admin.py`

### Business data

- [Agent FileStore](https://github.com/mohamedhishm/ai-agents-at-work/blob/main/eldockor/store/file_store.py): `eldockor/store/file_store.py`
- [User repository](https://github.com/mohamedhishm/ai-agents-at-work/blob/main/backend/app/repositories/user_repository.py): `backend/app/repositories/user_repository.py`
- [Order repository](https://github.com/mohamedhishm/ai-agents-at-work/blob/main/backend/app/repositories/order_repository.py): `backend/app/repositories/order_repository.py`
- [JSON file access](https://github.com/mohamedhishm/ai-agents-at-work/blob/main/backend/app/repositories/json_file.py): `backend/app/repositories/json_file.py`
- [Backend FileStore](https://github.com/mohamedhishm/ai-agents-at-work/blob/main/backend/agent/agent/store/file_store.py): `backend/agent/agent/store/file_store.py`

### Other components

- **Customer / admin**

## Connections

- Customer / admin → Operations UI: uses
- Operations UI → FastAPI app: requests API
- Chat interface → API client: sends messages
- Login flow → API client: authenticates via
- FastAPI app → API routes: mounts routes (evidence: `backend/app/main.py`)
- API routes → Agent service: routes agent requests
- API routes → Authentication: routes authentication
- API routes → Task routes: includes (evidence: `backend/app/api/router.py`)
- Task routes → Task operations: delegates tasks (evidence: `backend/app/api/routes/tasks.py`)
- Agent service → Conversation workflow: invokes agent (evidence: `backend/app/services/agent_service.py`)
- Conversation workflow → LLM adapter: invokes model (evidence: `eldockor/graph.py`)
- Conversation workflow → Agent prompts: uses prompts (evidence: `eldockor/graph.py`)
- Conversation workflow → Customer tools: dispatches customer tools (evidence: `eldockor/graph.py`)
- Conversation workflow → Admin tools: dispatches admin tools (evidence: `eldockor/graph.py`)
- Conversation workflow → Agent FileStore: reads and writes (evidence: `eldockor/graph.py`)
- Authentication → User repository: looks up users (evidence: `backend/app/services/auth_service.py`)
- Task operations → Order repository: manages orders (evidence: `backend/app/services/task_service.py`)
- User repository → JSON file access: reads and writes (evidence: `backend/app/repositories/user_repository.py`)
- Order repository → JSON file access: reads and writes (evidence: `backend/app/repositories/order_repository.py`)
- Backend agent graph → Backend prompts: uses prompts (evidence: `backend/agent/agent/graph.py`)
- Backend agent graph → Backend admin tools: uses admin tools (evidence: `backend/agent/agent/graph.py`)
- Backend agent graph → Backend FileStore: uses store (evidence: `backend/agent/agent/graph.py`)
