autogen/python
Victor Dibia cd085e6b89
Improve custom agentchat agent docs with model clients (gemini example) and serialization (#5468)
This PR improves documentation on custom agents 

- Shows example on how to create a custom agent that directly uses a
model client. In this case an example of a GeminiAssistantAgent that
directly uses the Gemini SDK model client.
- Shows that that CustomAgent can be easily added to any agentchat team 
- Shows how the same CustomAgent can be made declarative by inheriting
the Component interface and implementing the required methods.

Closes #5450
2025-02-10 16:29:43 -08:00
..
packages Improve custom agentchat agent docs with model clients (gemini example) and serialization (#5468) 2025-02-10 16:29:43 -08:00
samples bring back grpc service (#5377) 2025-02-07 19:28:55 -05:00
templates/new-package Fix definition of workspace package, remove uv pin (#4830) 2024-12-27 13:11:42 -05:00
.gitignore API documentation page flattening (#4556) 2024-12-04 18:24:07 -08:00
README.md docs(python): add instructions for syncing dependencies and checking samples (#5362) 2025-02-04 19:35:51 +00:00
check_md_code_blocks.py Migration guide for 0.4 (#4765) 2024-12-30 13:33:08 -08:00
fixup_generated_files.py Improve grpc type checking (#5189) 2025-01-24 12:34:59 -08:00
pyproject.toml bring back grpc service (#5377) 2025-02-07 19:28:55 -05:00
run_task_in_pkgs_if_exist.py Remove old autogen_magentic_one package. (#5305) 2025-01-31 15:14:40 -08:00
shared_tasks.toml Remove static subscription restriction (#439) 2024-08-30 14:00:11 -04:00
uv.lock Improve custom agentchat agent docs with model clients (gemini example) and serialization (#5468) 2025-02-10 16:29:43 -08:00

README.md

AutoGen Python packages

0.4 Docs PyPi autogen-core PyPi autogen-agentchat PyPi autogen-ext

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.

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. The all-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/