This folder contains a minimal Jupyter Notebook (main.ipynb) that demonstrates a very small multi‑agent workflow using AutoGen AgentChat. Two assistant agents collaborate in a round‑robin group chat to produce and refine a short joke about a chosen topic.
- Loads a model configuration via
load_model_config(). - Defines two agents:
Author– writes a SHORT joke about the topic.SmartassEditor– analyzes why it is (or isn’t) funny and makes it funnier without making it longer.
- Runs a
RoundRobinGroupChat, allowing each agent a single turn to contribute in sequence. - Prints the message sequence plus timing & stop info.
MESSAGE 0 [user]:
Invent a short joke about: Animals
----------------------------------------------------------------
MESSAGE 1 [Author]:
Why don't animals play poker in the jungle? Too many cheetahs.
----------------------------------------------------------------
MESSAGE 2 [SmartassEditor]:
Why it's funny: the joke is a classic pun — "cheetahs" sounds like "cheaters" — combined with the absurd image of animals playing poker. The humor comes from the wordplay and the surprise of the literal animal answer; it's a dad-joke style gag, so it's groan-inducing rather than sophisticated.
Funnier version (shorter and punchier):
Why don't jungle animals play poker? Too many cheetahs.
-
Activate your virtual environment in the project root.
-
Install dependencies (example with uv):
uv sync
Or with pip (editable install):
pip install -e . -
Configure model access
OpenAI or Azure OpenAI API key require one of
OPENAI_API_KEYorAZURE_OPENAI_API_KEYenv variables set (loaded via.envif present). Alternatively, a local ollama server can be used with a suitable model (changed inload_model_config()). -
Open
basic_example/main.ipynbin VS Code. -
Run cells top to bottom; final cells show each message and stop reason.
- Change the topic in
topic = "Animals". - Add or modify roles in the
agentConfigdict. - Uncomment
adjust_properties_for_fixed_response(...)for a deterministic test. - Use a different model by modifying the
load_model_config()function inmain.py.
create_chat_completion_client(model)– constructs the model client wrapper.AssistantAgent– defines an autonomous role with a system prompt.RoundRobinGroupChat– simple orchestrator cycling agents.invent_joke(topic)– async coroutine that runs the interaction.
Brief by design—see the notebook and tools.py for full details. The notebook closes the model_client explicitly (await model_client.close()).