This guide walks you through setting up agentm-py
, configuring it with your OpenAI API key, and setting up logging and the SQLite database.
First, clone the repository to your local machine:
# Clone the repository
git clone https://github.com/Stevedic/agentm-py.git
cd agentm-py
Set up and activate a virtual environment using pipenv
or venv
:
pipenv install
pipenv shell
python -m venv venv-py312
source venv-py312/bin/activate # On Windows: venv-py312\Scripts\activate
pip install -r requirements.txt
The install.py
script will prompt you for necessary configuration, such as the OpenAI API key and log locations. It will also create the database and logs directories.
Run the script:
python install.py
- OpenAI API Key: This key will be stored in the
config/settings.json
file. - Log Directory: By default, logs will be stored under
./var/logs
. - Database Directory: The SQLite database (
agents.db
) will be created in./var/data
.
Before running the installation script, the project directory structure will look like this:
agentm-py/
├── README.md
├── requirements.txt
├── Pipfile
├── LICENSE
├── .gitignore
├── Pipfile.lock
├── install.py
├── config/
│ └── __init__.py
├── core/
│ ├── database.py
│ ├── openai_api.py
│ ├── logging.py
│ ├── token_counter.py
│ ├── concurrency.py
│ ├── prompt_generation.py
│ ├── parallel_complete_prompt.py
│ ├── log_complete_prompt.py
│ ├── compose_prompt.py
│ └── __init__.py
├── tests/
│ ├── test_openai_api.py
│ ├── test_token_counter.py
│ ├── test_prompt_generation.py
│ ├── test_parallel_complete_prompt.py
│ ├── test_compose_prompt.py
│ ├── test_log_complete_prompt.py
│ └── test_database.py
├── src/
│ └── __init__.py
├── docs/
│ └── __init__.py
└── .github/
└── workflows/
└── ci.yml
Once the installation is complete, the project directory structure will be updated to include log files and the SQLite database:
agentm-py/
├── README.md
├── requirements.txt
├── Pipfile
├── LICENSE
├── .gitignore
├── Pipfile.lock
├── install.py
├── config/
│ ├── settings.json
│ └── __init__.py
├── core/
│ ├── database.py
│ ├── openai_api.py
│ ├── logging.py
│ ├── token_counter.py
│ ├── concurrency.py
│ ├── prompt_generation.py
│ ├── parallel_complete_prompt.py
│ ├── log_complete_prompt.py
│ ├── compose_prompt.py
│ └── __init__.py
├── var/
│ ├── data/
│ │ └── agents.db
│ └── logs/
│ └── error.log
├── tests/
│ ├── test_openai_api.py
│ ├── test_token_counter.py
│ ├── test_prompt_generation.py
│ ├── test_parallel_complete_prompt.py
│ ├── test_compose_prompt.py
│ ├── test_log_complete_prompt.py
│ └── test_database.py
├── src/
│ └── __init__.py
├── docs/
│ └── __init__.py
└── .github/
└── workflows/
└── ci.yml
Once installation is complete, a settings.json
file will be created in the config/
folder, which will store your configurations (like the OpenAI API key and log locations).
Example settings.json
:
{
"openai_api_key": "sk-...",
"log_path": "./var/logs/error.log",
"database_path": "./var/data/agents.db"
}
To run the tests, use pytest
:
pytest
Make sure to configure the necessary API keys and paths in the config/settings.json
before running tests that interact with the OpenAI API.