# yoheinakajima/babyagi architecture

> Architecture diagram of the GitHub repository yoheinakajima/babyagi, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yoheinakajima/babyagi
- Repository: https://github.com/yoheinakajima/babyagi

## Overview

BabyAGI is an experimental framework for registering, storing, and executing reusable functions, including an exploratory self-building-agent workflow. Users register or load functions, then invoke them directly or through the API; the executor resolves dependencies and secrets, records execution logs, and runs triggers. The dashboard and API provide function, version, key, dependency, and log management. README capabilities are included where documented; some pack and route wiring is not shown in the sampled source, so uncertain links are omitted.

Main entry points: [`babyagi/__init__.py`](https://github.com/yoheinakajima/babyagi/blob/main/babyagi/__init__.py) (Package entry), [`babyagi/api/__init__.py`](https://github.com/yoheinakajima/babyagi/blob/main/babyagi/api/__init__.py) (HTTP API), [`babyagi/functionz/db/db_router.py`](https://github.com/yoheinakajima/babyagi/blob/main/babyagi/functionz/db/db_router.py) (Database router), [`babyagi/functionz/core/framework.py`](https://github.com/yoheinakajima/babyagi/blob/main/babyagi/functionz/core/framework.py) (Framework)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_framework["Function framework"]
  node_babyagi["Package entry<br/>[__init__.py]"]
  node_framework_core["Framework<br/>[framework.py]"]
  node_registration["Registration<br/>[registration.py]"]
  node_execution["Function executor<br/>[execution.py]"]
end

subgraph group_storage["Persistence"]
  node_db_router["Database router<br/>[db_router.py]"]
  node_local_db[("Local database<br/>[local_db.py]")]
  node_db_models["Data models<br/>[models.py]"]
end

subgraph group_interfaces["User interfaces"]
  node_api["HTTP API<br/>[__init__.py]"]
  node_dashboard["Dashboard routes<br/>[__init__.py]"]
  node_function_ui["Function details UI"]
  node_log_ui["Logs and graphs UI<br/>[log_dashboard.js]"]
end

subgraph group_packs["Function packs"]
  node_default_pack["Default functions"]
  node_ai_pack["AI functions<br/>[ai_functions.py]"]
  node_chat_pack["Function calling chat"]
  node_drafts["Agent and code drafts"]
end

subgraph group_integrations["External integrations"]
  node_plugin_pack["Plugin functions"]
end

node_developer(("Developer"))
node_browser(("Browser user"))
node_external_services["External services"]

node_developer -->|"registers or loads"| node_babyagi
node_babyagi -->|"creates framework"| node_framework_core
node_babyagi -->|"registers blueprint"| node_api
node_babyagi -->|"creates dashboard"| node_dashboard
node_framework_core -->|"uses"| node_registration
node_framework_core -->|"uses"| node_execution
node_framework_core -->|"uses"| node_db_router
node_registration -->|"stores function data"| node_db_router
node_registration -->|"runs update triggers"| node_execution
node_execution -->|"reads and logs"| node_db_router
node_db_router -->|"routes database calls"| node_local_db
node_local_db -->|"persists records"| node_db_models
node_browser -->|"sends API requests"| node_api
node_browser -->|"opens dashboard"| node_dashboard
node_api -->|"executes functions"| node_execution
node_api -->|"reads and updates"| node_db_router
node_dashboard -->|"reads function data"| node_db_router
node_function_ui -->|"requests function actions"| node_api
node_log_ui -->|"requests log data"| node_api
node_babyagi -->|"loads pack"| node_default_pack
node_babyagi -->|"loads pack"| node_ai_pack
node_babyagi -->|"loads pack"| node_chat_pack
node_framework_core -->|"loads function packs"| node_drafts
node_ai_pack -.->|"calls language model"| node_external_services
node_drafts -->|"uses search and scraping functions"| node_plugin_pack
node_plugin_pack -.->|"calls service APIs"| node_external_services

click node_babyagi "https://github.com/yoheinakajima/babyagi/blob/main/babyagi/__init__.py"
click node_framework_core "https://github.com/yoheinakajima/babyagi/blob/main/babyagi/functionz/core/framework.py"
click node_registration "https://github.com/yoheinakajima/babyagi/blob/main/babyagi/functionz/core/registration.py"
click node_execution "https://github.com/yoheinakajima/babyagi/blob/main/babyagi/functionz/core/execution.py"
click node_db_router "https://github.com/yoheinakajima/babyagi/blob/main/babyagi/functionz/db/db_router.py"
click node_local_db "https://github.com/yoheinakajima/babyagi/blob/main/babyagi/functionz/db/local_db.py"
click node_db_models "https://github.com/yoheinakajima/babyagi/blob/main/babyagi/functionz/db/models.py"
click node_api "https://github.com/yoheinakajima/babyagi/blob/main/babyagi/api/__init__.py"
click node_dashboard "https://github.com/yoheinakajima/babyagi/blob/main/babyagi/dashboard/__init__.py"
click node_function_ui "https://github.com/yoheinakajima/babyagi/blob/main/babyagi/dashboard/static/js/function_details.js"
click node_log_ui "https://github.com/yoheinakajima/babyagi/blob/main/babyagi/dashboard/static/js/log_dashboard.js"
click node_default_pack "https://github.com/yoheinakajima/babyagi/blob/main/babyagi/functionz/packs/default/default_functions.py"
click node_ai_pack "https://github.com/yoheinakajima/babyagi/blob/main/babyagi/functionz/packs/default/ai_functions.py"
click node_chat_pack "https://github.com/yoheinakajima/babyagi/blob/main/babyagi/functionz/packs/default/function_calling_chat.py"
click node_drafts "https://github.com/yoheinakajima/babyagi/tree/main/babyagi/functionz/packs/drafts"
click node_plugin_pack "https://github.com/yoheinakajima/babyagi/tree/main/babyagi/functionz/packs/plugins"

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_babyagi,node_framework_core,node_registration,node_execution,node_browser toneBlue
class node_db_router,node_local_db,node_db_models toneAmber
class node_api,node_dashboard,node_function_ui,node_log_ui toneMint
class node_default_pack,node_ai_pack,node_chat_pack,node_drafts toneRose
class node_plugin_pack,node_developer,node_external_services toneIndigo
```

## Components

### Function framework

- [Package entry](https://github.com/yoheinakajima/babyagi/blob/main/babyagi/__init__.py): `babyagi/__init__.py`
- [Framework](https://github.com/yoheinakajima/babyagi/blob/main/babyagi/functionz/core/framework.py): `babyagi/functionz/core/framework.py`
- [Registration](https://github.com/yoheinakajima/babyagi/blob/main/babyagi/functionz/core/registration.py): `babyagi/functionz/core/registration.py`
- [Function executor](https://github.com/yoheinakajima/babyagi/blob/main/babyagi/functionz/core/execution.py): `babyagi/functionz/core/execution.py`

### Persistence

- [Database router](https://github.com/yoheinakajima/babyagi/blob/main/babyagi/functionz/db/db_router.py): `babyagi/functionz/db/db_router.py`
- [Local database](https://github.com/yoheinakajima/babyagi/blob/main/babyagi/functionz/db/local_db.py): `babyagi/functionz/db/local_db.py`
- [Data models](https://github.com/yoheinakajima/babyagi/blob/main/babyagi/functionz/db/models.py): `babyagi/functionz/db/models.py`

### User interfaces

- [HTTP API](https://github.com/yoheinakajima/babyagi/blob/main/babyagi/api/__init__.py): `babyagi/api/__init__.py`
- [Dashboard routes](https://github.com/yoheinakajima/babyagi/blob/main/babyagi/dashboard/__init__.py): `babyagi/dashboard/__init__.py`
- [Function details UI](https://github.com/yoheinakajima/babyagi/blob/main/babyagi/dashboard/static/js/function_details.js): `babyagi/dashboard/static/js/function_details.js`
- [Logs and graphs UI](https://github.com/yoheinakajima/babyagi/blob/main/babyagi/dashboard/static/js/log_dashboard.js): `babyagi/dashboard/static/js/log_dashboard.js`

### Function packs

- [Default functions](https://github.com/yoheinakajima/babyagi/blob/main/babyagi/functionz/packs/default/default_functions.py): `babyagi/functionz/packs/default/default_functions.py`
- [AI functions](https://github.com/yoheinakajima/babyagi/blob/main/babyagi/functionz/packs/default/ai_functions.py): `babyagi/functionz/packs/default/ai_functions.py`
- [Function calling chat](https://github.com/yoheinakajima/babyagi/blob/main/babyagi/functionz/packs/default/function_calling_chat.py): `babyagi/functionz/packs/default/function_calling_chat.py`
- [Agent and code drafts](https://github.com/yoheinakajima/babyagi/tree/main/babyagi/functionz/packs/drafts): `babyagi/functionz/packs/drafts`

### External integrations

- [Plugin functions](https://github.com/yoheinakajima/babyagi/tree/main/babyagi/functionz/packs/plugins): `babyagi/functionz/packs/plugins`

### Other components

- **Developer**
- **Browser user**
- **External services**

## Connections

- Developer → Package entry: registers or loads
- Package entry → Framework: creates framework
- Package entry → HTTP API: registers blueprint
- Package entry → Dashboard routes: creates dashboard
- Framework → Registration: uses
- Framework → Function executor: uses
- Framework → Database router: uses
- Registration → Database router: stores function data
- Registration → Function executor: runs update triggers
- Function executor → Database router: reads and logs
- Database router → Local database: routes database calls
- Local database → Data models: persists records
- Browser user → HTTP API: sends API requests
- Browser user → Dashboard routes: opens dashboard
- HTTP API → Function executor: executes functions
- HTTP API → Database router: reads and updates
- Dashboard routes → Database router: reads function data
- Function details UI → HTTP API: requests function actions
- Logs and graphs UI → HTTP API: requests log data
- Package entry → Default functions: loads pack
- Package entry → AI functions: loads pack
- Package entry → Function calling chat: loads pack
- Framework → Agent and code drafts: loads function packs
- AI functions → External services: calls language model
- Agent and code drafts → Plugin functions: uses search and scraping functions
- Plugin functions → External services: calls service APIs
