Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emrgnt-cmplxty/automata
Automata: A self-coding agent
https://github.com/emrgnt-cmplxty/automata
agi ai autonomous-agents autonomous-systems gpt gpt-4 llm openai
Last synced: about 2 months ago
JSON representation
Automata: A self-coding agent
- Host: GitHub
- URL: https://github.com/emrgnt-cmplxty/automata
- Owner: emrgnt-cmplxty
- License: apache-2.0
- Archived: true
- Created: 2023-06-20T16:05:36.000Z (over 1 year ago)
- Default Branch: full-automata
- Last Pushed: 2023-09-05T21:24:32.000Z (over 1 year ago)
- Last Synced: 2024-08-01T19:42:42.297Z (5 months ago)
- Topics: agi, ai, autonomous-agents, autonomous-systems, gpt, gpt-4, llm, openai
- Language: Python
- Homepage:
- Size: 194 MB
- Stars: 597
- Watchers: 14
- Forks: 98
- Open Issues: 27
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-ai-agents - GitHub
README
# Automata: The Future is Self-Written
[![codecov](https://codecov.io/github/emrgnt-cmplxty/Automata/branch/main/graph/badge.svg?token=ZNE7RDUJQD)](https://codecov.io/github/emrgnt-cmplxty/Automata)
[![CodeFactor](https://www.codefactor.io/repository/github/emrgnt-cmplxty/automata/badge)](https://www.codefactor.io/repository/github/emrgnt-cmplxty/automata)
[![Documentation Status](https://readthedocs.org/projects/automata/badge/?version=latest)](https://automata.readthedocs.io/en/latest/?badge=latest)## Socials
[![Discord](https://img.shields.io/discord/1120774652915105934?logo=discord)](https://discord.gg/j9GxfbxqAe)
[![Twitter Follow](https://img.shields.io/twitter/follow/ocolegro?style=social)](https://twitter.com/ocolegro)
[![GitHub star chart](https://img.shields.io/github/stars/emrgnt-cmplxty/Automata?style=social)](https://star-history.com/#emrgnt-cmplxty/Automata)### **Automata's objective is to evolve into a fully autonomous, self-programming Artificial Intelligence system**.
Automata is inspired by the theory that code is essentially a form of memory, and when furnished with the right tools, AI can evolve real-time capabilities which can potentially lead to the creation of AGI. The word automata comes from the Greek word αὐτόματος, denoting "self-acting, self-willed, self-moving,", and [Automata theory](https://en.wikipedia.org/wiki/Automata_theory) is the study of abstract machines and [automata](https://en.wikipedia.org/wiki/Automaton), as well as the computational problems that can be solved using them.
More information follows below.
## Codespace
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/emrgnt-cmplxty/Automata)## Rough Schematic
---
## Demo
https://github.com/emrgnt-cmplxty/Automata/assets/68796651/2e1ceb8c-ac93-432b-af42-c383ea7607d7
## Installation and Usage
### 🧠 [Stuck? Try the Docs](https://automata.readthedocs.io/en/latest/)
### Initial Setup
Follow these steps to setup the Automata environment
```bash
# Clone the repository
git clone [email protected]:emrgnt-cmplxty/Automata.git && cd Automata/# Initialize git submodules
git submodule update --init# Install poetry and the project
pip3 install poetry && poetry install# Configure the environment and setup files
poetry run automata configure
```Installation via Docker
You can also install Automata through Docker.Pull the Docker image:
```console
$ docker pull ghcr.io/emrgnt-cmplxty/automata:latest
```Run the Docker image:
```console
$ docker run --name automata_container -it --rm -e OPENAI_API_KEY= -e GITHUB_API_KEY= ghcr.io/emrgnt-cmplxty/automata:latest
```This will start a Docker container with Automata installed and open an interactive shell for you to use.
Windows Tips
Windows users may need to install C++ support through [Visual Studio's "Desktop development with C++"](https://visualstudio.microsoft.com/downloads/?q=build+tools) for certain dependencies.
Additionally, updating to gcc-11 and g++-11 may be required. This can be done by running the following commands:
```bash
# Adds the test toolchain repository, which contains newer versions of software
sudo add-apt-repository ppa:ubuntu-toolchain-r/test# Updates the list of packages on your system
sudo apt update# Installs gcc-11 and g++-11 packages
sudo apt install gcc-11 g++-11# Sets gcc-11 and g++-11 as the default gcc and g++ versions for your system
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 60 --slave /usr/bin/g++ g++ /usr/bin/g++-11
```### Indexing
[SCIP indices](https://about.sourcegraph.com/blog/announcing-scip) are required to run the Automata Search. These indices are used to create the code graph which relates symbols by dependencies across the codebase. New indices are generated and uploaded periodically for the Automata codebase, but programmers must be generate them manually if necessary for their local development. If you encounter issues, we recommend referring to the [instructions here](https://github.com/sourcegraph/scip-python).
```bash
# Install dependencies and run indexing on the local codebase
poetry run automata install-indexing
```### Build the embeddings + docs
```
# Refresh the code embeddings (after making local changes)
poetry run automata run-code-embedding# Refresh the documentation + embeddings
poetry run automata run-doc-embedding --embedding-level=2
```### Run the system
The following commands illustrate how to run the system with a trivial instruction. It is recommended that your initial run is something of this sort to ensure the system is working as expected.
```bash
# Run a single agent w/ trivial instruction
poetry run automata run-agent --instructions="Return true" --model=gpt-3.5-turbo-0613# Run a single agent w/ a non-trivial instruction
poetry run automata run-agent --instructions="Explain what AutomataAgent is and how it works, include an example to initialize an instance of AutomataAgent."
```---
## Understanding Automata
Automata works by combining Large Language Models, such as GPT-4, with a vector database to form an integrated system capable of documenting, searching, and writing code. The procedure initiates with the generation of comprehensive documentation and code instances. This, coupled with search capabilities, forms the foundation for Automata's self-coding potential.
Automata employs downstream tooling to execute advanced coding tasks, continually building its expertise and autonomy. This self-coding approach mirrors an autonomous craftsman's work, where tools and techniques are consistently refined based on feedback and accumulated experience.
### Example - Building your own agent
Sometimes the best way to understand a complicated system is to start by understanding a basic example. The following example illustrates how to run your own Automata agent. The agent will be initialized with a trivial instruction, and will then attempt to write code to fulfill the instruction. The agent will then return the result of its attempt.
```python
from automata.config.base import AgentConfigName, OpenAIAutomataAgentConfigBuilder
from automata.agent import OpenAIAutomataAgent
from automata.singletons.dependency_factory import dependency_factory
from automata.singletons.py_module_loader import py_module_loader
from automata.tools.factory import AgentToolFactory# Initialize the module loader to the local directory
py_module_loader.initialize()# Construct the set of all dependencies that will be used to build the tools
toolkit_list = ["context-oracle"]
tool_dependencies = dependency_factory.build_dependencies_for_tools(toolkit_list)# Build the tools
tools = AgentToolFactory.build_tools(toolkit_list, **tool_dependencies)# Build the agent config
agent_config = (
OpenAIAutomataAgentConfigBuilder.from_name("automata-main")
.with_tools(tools)
.with_model("gpt-4")
.build()
)# Initialize and run the agent
instructions = "Explain how embeddings are used by the codebase"
agent = OpenAIAutomataAgent(instructions, config=agent_config)
result = agent.run()
```Click to see the output
Embeddings in this codebase are represented by classes such as `SymbolCodeEmbedding` and `SymbolDocEmbedding`. These classes store information about a symbol and its respective embeddings which are vectors representing the symbol in high-dimensional space.
Examples of these classes are:
`SymbolCodeEmbedding` a class used for storing embeddings related to the code of a symbol.
`SymbolDocEmbedding` a class used for storing embeddings related to the documentation of a symbol.Code example for creating an instance of 'SymbolCodeEmbedding':
```python
import numpy as np
from automata.symbol_embedding.base import SymbolCodeEmbedding
from automata.symbol.parser import parse_symbolsymbol_str = 'scip-python python automata 75482692a6fe30c72db516201a6f47d9fb4af065 `automata.agent.agent_enums`/ActionIndicator#'
symbol = parse_symbol(symbol_str)
source_code = 'symbol_source'
vector = np.array([1, 0, 0, 0])embedding = SymbolCodeEmbedding(symbol=symbol, source_code=source_code, vector=vector)
```Code example for creating an instance of 'SymbolDocEmbedding':
```python
from automata.symbol_embedding.base import SymbolDocEmbedding
from automata.symbol.parser import parse_symbol
import numpy as npsymbol = parse_symbol('your_symbol_here')
document = 'A document string containing information about the symbol.'
vector = np.random.rand(10)symbol_doc_embedding = SymbolDocEmbedding(symbol, document, vector)
```## Contribution guidelines
**If you want to contribute to Automata, be sure to review the
[contribution guidelines](CONTRIBUTING.md). This project adheres to Automata's
[code of conduct](CODE_OF_CONDUCT.md). By participating, you are expected to
uphold this code.**We use [GitHub issues](https://github.com/emrgnt-cmplxty/automata/issues) for
tracking requests and bugs, please see
[Automata Discussions](https://github.com/emrgnt-cmplxty/Automata/discussions/) for general questions and
discussion, and please direct specific questions.The Automata project strives to abide by generally accepted best practices in
open-source software development.## Future
The ultimate goal of the Automata project is to achieve a level of proficiency where it can independently design, write, test, and refine complex software systems. This includes the ability to understand and navigate large codebases, reason about software architecture, optimize performance, and even invent new algorithms or data structures when necessary.
While the complete realization of this goal is likely to be a complex and long-term endeavor, each incremental step towards it not only has the potential to dramatically increase the productivity of human programmers, but also to shed light on fundamental questions in AI and computer science.
## License
Automata is licensed under the Apache License 2.0.
## Other
This project is an extension of an initial effort between [emrgnt-cmplxty](https://github.com/emrgnt-cmplxty) and [maks-ivanov](https://github.com/maks-ivanov) that began with this [repository](https://github.com/maks-ivanov/automata).