
_(EXPERIMENTAL, RESEARCH IN PROGRESS)_ In 2023 AutoGen introduced [Teachable Agents](https://microsoft.github.io/autogen/0.2/blog/2023/10/26/TeachableAgent/) that users could teach new facts, preferences and skills. But teachable agents were limited in several ways: They could only be `ConversableAgent` subclasses, they couldn't learn a new skill unless the user stated (in a single turn) both the task and how to solve it, and they couldn't learn on their own. **Task-Centric Memory** overcomes these limitations, allowing users to teach arbitrary agents (or teams) more flexibly and reliably, and enabling agents to learn from their own trial-and-error experiences. This PR is large and complex. All of the files are new, and most of the added components depend on the others to run at all. But the review process can be accelerated if approached in the following order. 1. Start with the [Task-Centric Memory README](https://github.com/microsoft/autogen/tree/agentic_memory/python/packages/autogen-ext/src/autogen_ext/task_centric_memory). 1. Install the memory extension locally, since it won't be in pypi until it's merged. In the `agentic_memory` branch, and the `python/packages` directory: - `pip install -e autogen-agentchat` - `pip install -e autogen-ext[openai]` - `pip install -e autogen-ext[task-centric-memory]` 2. Run the Quickstart sample code, then immediately open the `./pagelogs/quick/0 Call Tree.html` file in a browser to view the work in progress. 3. Click through the web page links to see the details. 2. Continue through the rest of the main README to get a high-level overview of the architecture. 3. Read through the [code samples README](https://github.com/microsoft/autogen/tree/agentic_memory/python/samples/task_centric_memory), running each of the 4 code samples while viewing their page logs. 4. Skim through the 4 code samples, along with their corresponding yaml config files: 1. `chat_with_teachable_agent.py` 2. `eval_retrieval.py` 3. `eval_teachability.py` 4. `eval_learning_from_demonstration.py` 5. `eval_self_teaching.py` 6. Read `task_centric_memory_controller.py`, referring back to the previously generated page logs as needed. This is the most important and complex file in the PR. 7. Read the remaining core files. 1. `_task_centric_memory_bank.py` 2. `_string_similarity_map.py` 3. `_prompter.py` 8. Read the supporting files in the utils dir. 1. `teachability.py` 2. `apprentice.py` 3. `grader.py` 4. `page_logger.py` 5. `_functions.py`
AutoGen Python packages
This directory works as a single uv
workspace containing all project packages. See packages
to discover all project packages.
Migrating from 0.2.x?
Please refer to the migration guide for how to migrate your code from 0.2.x to 0.4.x.
Development
TL;DR, run all checks with:
uv sync --all-extras
source .venv/bin/activate
poe check
Setup
uv
is a package manager that assists in creating the necessary environment and installing packages to run AutoGen.
Note: To prevent incompatibilities between versions the same UV version as is running in CI should be used. Check the version in CI by looking the setup-uv
action, here for example.
For example, to change your version to 0.5.18
, run:
uv self update 0.5.18
Virtual Environment
During development, you may need to test changes made to any of the packages.
To do so, create a virtual environment where the AutoGen packages are installed based on the current state of the directory.
Run the following commands at the root level of the Python directory:
uv sync --all-extras
source .venv/bin/activate
uv sync --all-extras
will create a.venv
directory at the current level and install packages from the current directory along with any other dependencies. Theall-extras
flag adds optional dependencies.source .venv/bin/activate
activates the virtual environment.
Common Tasks
To create a pull request (PR), ensure the following checks are met. You can run each check individually:
- Format:
poe format
- Lint:
poe lint
- Test:
poe test
- Mypy:
poe mypy
- Pyright:
poe pyright
- Build docs:
poe --directory ./packages/autogen-core/ docs-build
- Auto rebuild+serve docs:
poe --directory ./packages/autogen-core/ docs-serve
- Check samples in
python/samples
:poe samples-code-check
Alternatively, you can run all the checks with: poe check
Note
These need to be run in the virtual environment.
Syncing Dependencies
When you pull new changes, you may need to update the dependencies.
To do so, first make sure you are in the virtual environment, and then in the python
directory, run:
uv sync --all-extras
This will update the dependencies in the virtual environment.
Creating a New Package
To create a new package, similar to autogen-core
or autogen-chat
, use the following:
uv sync --python 3.12
source .venv/bin/activate
cookiecutter ./templates/new-package/