autogen/python/packages/autogen-core/samples
Jack Gerrits 5b9be79fba
feat!: Add message context to signature of intervention handler, add more to docs (#4882)
* Add message context to signature of intervention handler, add more to docs

* example

* Add to test

* Fix pyright

* mypy
2025-01-07 12:51:35 -05:00
..
common use model context for assistant agent, refactor model context (#4681) 2024-12-19 22:27:41 -08:00
distributed-group-chat Add models.openai and tools.langchain namespaces (#4601) 2024-12-09 19:18:09 -08:00
protos Rysweet refactor 4670 rename abstractions to contracts (#4674) 2024-12-12 19:43:26 -08:00
semantic_router Update references in docs (#4590) 2024-12-06 01:59:28 -08:00
worker Move grpc runtimes to ext, flatten application (#4553) 2024-12-04 16:23:20 -08:00
xlang/hello_python_agent Rysweet 4676 remove iagentruntime - collapse into iagentworker (#4740) 2024-12-17 13:04:37 -08:00
README.md Remove unused sample script (#3841) 2024-10-18 10:41:30 -04:00
chess_game.py Migrate remaining components (#4626) 2024-12-09 18:39:07 -08:00
slow_human_in_loop.py feat!: Add message context to signature of intervention handler, add more to docs (#4882) 2025-01-07 12:51:35 -05:00

README.md

Samples

This directory contains sample apps that use AutoGen Core API. See core user guide for notebook examples.

See Running the examples for instructions on how to run the examples.

  • chess_game.py: an example with two chess player agents that executes its own tools to demonstrate tool use and reflection on tool use.
  • slow_human_in_loop.py: an example showing human-in-the-loop which waits for human input before making the tool call.

Running the examples

Prerequisites

First, you need a shell with AutoGen core and required dependencies installed.

Using Azure OpenAI API

For Azure OpenAI API, you need to set the following environment variables:

export OPENAI_API_TYPE=azure
export AZURE_OPENAI_API_ENDPOINT=your_azure_openai_endpoint
export AZURE_OPENAI_API_VERSION=your_azure_openai_api_version

By default, we use Azure Active Directory (AAD) for authentication. You need to run az login first to authenticate with Azure. You can also use API key authentication by setting the following environment variables:

export AZURE_OPENAI_API_KEY=your_azure_openai_api_key

This requires azure-identity installation:

pip install azure-identity

Using OpenAI API

For OpenAI API, you need to set the following environment variables.

export OPENAI_API_TYPE=openai
export OPENAI_API_KEY=your_openai_api_key