yoheinakajima /babyagi

★ 22,353⑂ 2,835
PythonCreated 2023-04-03babyagi.org/
22,353
stars
+1+0+-8
2,835
forks
–
watchers
–
prs
–
issues
–
releases
–
discussions

README

BabyAGI

 [!NOTE]
 The original BabyAGI from March 2023 introduced task planning as a method for developing autonomous agents. This project has been archived and moved to the babyagi_archive repo (September 2024 snapshot).

 [!CAUTION]
 This is a framework built by Yohei who has never held a job as a developer. The purpose of this repo is to share ideas and spark discussion and for experienced devs to play with. Not meant for production use. Use with cautioun.

---

This newest BabyAGI is an experimental framework for a self-building autonomous agent. Earlier efforts to expand BabyAGI have made it clear that the optimal way to build a general autonomous agent is to build the simplest thing that can build itself.

Check out this introductory X/Twitter thread for a simple overview.

The core is a new function framework (functionz) for storing, managing, and executing functions from a database. It offers a graph-based structure for tracking imports, dependent functions, and authentication secrets, with automatic loading and comprehensive logging capabilities. Additionally, it comes with a dashboard for managing functions, running updates, and viewing logs.

 Table of Contents

- Quick Start
- Basic Usage
- Function Metadata
- Function Loading
- Key Dependencies
- Execution Environment
  - Log
- Dashboard
- Pre-loaded Functions
- Future/Draft Features
- API Reference
- Contributing
- License

 Quick Start

To quickly check out the dashboard and see how it works:

1. Install BabyAGI:

    bash
    pip install babyagi
    

2. Import BabyAGI and load the dashboard:

    python
    import babyagi

    if __name__ == "__main__":
        app = babyagi.create_app('/dashboard')
        app.run(host='0.0.0.0', port=8080)
    

3. Navigate to the dashboard:

    Open your browser and go to http://localhost:8080/dashboard to access the BabyAGI dashboard.
    
 Basic Usage

Start by importing babyagi and registering your functions. Here's how to register two functions, where one depends on the other:

python
import babyagi

 Register a simple function
@babyagi.register_function()
def world():
    return "world"

 Register a function that depends on 'world'
@babyagi.register_function(dependencies=["world"])
def hello_world():
    x = world()
    return f"Hello {x}!"

 Execute the function
print(babyagi.hello_world())   Output: Hello world!

if __name__ == "__main__":
    app = babyagi.create_app('/dashboard')
    app.run(host='0.0.0.0', port=8080)


 Function Metadata

Functions can be registered with metadata to enhance their capabilities and manage their relationships. Here's a more comprehensive example of function metadata, showing logical usage of all fields:

python
import babyagi

@babyagi.register_function(
    imports=["math"],
    dependencies=["circle_area"],
    key_dependencies=["openai_api_key"],
    metadata={
        "description": "Calculates the volume of a cylinder using the circle_area function."
    }
)
def cylinder_volume(radius, height):
 

Snapshot: 2026-11-10T09:35:25Z · Data license Apache-2.0 · JSON