autogen/python/packages/autogen-studio/notebooks/tutorial.ipynb

106 lines
2.5 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
"from autogenstudio import WorkflowManager"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## AutoGen Studio Agent Workflow API Example\n",
"\n",
"This notebook focuses on demonstrating capabilities of the autogen studio workflow python api. \n",
"\n",
"- Declarative Specification of an Agent Workflow \n",
"- Loading the specification and running the resulting agent\n",
"\n",
"\n",
"> Note: The notebook currently demonstrates support for a two agent setup. Support for GroupChat is currently in development."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# load workflow from json file\n",
"workflow_manager = WorkflowManager(workflow=\"two_agent.json\")\n",
"\n",
"# run the workflow on a task\n",
"task_query = \"What is the height of the Eiffel Tower?. Dont write code, just respond to the question.\"\n",
"workflow_manager.run(message=task_query)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# print the agent history\n",
"workflow_manager.agent_history"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Group Chat Agent"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# load workflow from json file\n",
"travel_workflow_manager = WorkflowManager(workflow=\"travel_groupchat.json\")\n",
"\n",
"# run the workflow on a task\n",
"task_query = \"Plan a two day trip to Maui hawaii.\"\n",
"travel_workflow_manager.run(message=task_query)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# print the agent history\n",
"print(len(travel_workflow_manager.agent_history), \"agent messages were involved in the conversation\")\n",
"travel_workflow_manager.agent_history"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "coral",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 2
}