autogen/python/packages/autogen-core/samples
Jack Gerrits 3022369eeb
Flatten core base and components (#4513)
* Flatten core base and components

* remove extra files

* dont export from deprecated locations

* format

* fmt
2024-12-03 17:00:44 -08:00
..
common Flatten core base and components (#4513) 2024-12-03 17:00:44 -08:00
distributed-group-chat Flatten core base and components (#4513) 2024-12-03 17:00:44 -08:00
protos HelloAgents App Host with xlang sample (#4395) 2024-12-03 08:09:02 -08:00
semantic_router Flatten core base and components (#4513) 2024-12-03 17:00:44 -08:00
worker Flatten core base and components (#4513) 2024-12-03 17:00:44 -08:00
xlang/hello_python_agent Flatten core base and components (#4513) 2024-12-03 17:00:44 -08:00
README.md Remove unused sample script (#3841) 2024-10-18 10:41:30 -04:00
chess_game.py Flatten core base and components (#4513) 2024-12-03 17:00:44 -08:00
slow_human_in_loop.py Flatten core base and components (#4513) 2024-12-03 17:00:44 -08: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