Skip to content

Standup Comedians

Multi-Agent Conversation and Stand up ComedyΒΆ

Example 1 overview Example 1 overview

This guide walks you through creating a conversational flow in JupyterLab using the Waldiez extension, where two agents, "Joe" and "Cathy," simulate a standup comedy exchange. We will configure an OpenAI model (GPT-3.5-turbo) for this flow and observe the interaction between the agents.


Using user input to start the conversationΒΆ

In this example, we will set up a flow where the user initiates the conversation by providing an initial message. The agents, Joe and Cathy, will then respond to each other based on the user input and the previous agent's message.

Open JupyterLab and Launch WaldiezΒΆ

  1. Start JupyterLab.
  2. In the launcher, under the Waldiez section, select the Waldiez icon to create a new .waldiez file. This opens a new interface for setting up agents and configuring the flow.

Add a ModelΒΆ

  1. In the Waldiez interface, click on Add model to add a new model configuration.
  2. Fill out the configuration fields:
    • Name: gpt-3.5-turbo
    • Model Type: Select OpenAI.
    • API Key: Enter your OpenAI API key (make sure you have GPT-3.5-turbo access).
  3. Optionally adjust Advanced Settings like Temperature and Max Tokens as per your needs.
  4. Click Save to add the model to your flow.

Create AgentsΒΆ

Agent 1: CathyΒΆ
  1. Under the Agents section, drag a new agent onto the canvas.
  2. Name the agent Cathy.
  3. Set the description to "Cathy is a standup comedian."
  4. In the System Message field, enter: Your name is Cathy and you are a standup comedian.
  5. Link the gpt-3.5-turbo model to Cathy by selecting it in the Models tab.
  6. Save the configuration.
Agent 2: JoeΒΆ
  1. Add another agent to the canvas and name it Joe.
  2. Set the description to "Joe is a standup comedian."
  3. In the System Message field, enter: Your name is Joe and you are a standup comedian. Start the next joke from the previous punchline.
  4. Link the gpt-3.5-turbo model to Joe.
  5. Save the configuration.

  1. In the Waldiez canvas, create a chat link between Joe and Cathy.
  2. Click on the link and configure the following settings:
    • Chat Type: Leave this as is: "Chat."
    • Name: Joe => Cathy.
    • Max Turns: Specify the number of turns for their exchange (e.g., 3).
  3. Click Save to apply the settings.

Update the Flow's settingsΒΆ

  1. Open the Edit Flow settings.
  2. Name the flow, e.g., Standup comedians 1, and add a description like "Standup comedians with user input."
  3. Add the chat link Joe => Cathy to the flow sequence to specify the conversation order.
  4. Save the flow configuration.

Initiate the ChatΒΆ

  1. Click on the Run button to start the flow.
  2. Start the flow by providing an initial message in the User Input window, such as:

    Hi Cathy, I'm Joe. Let's keep the jokes rolling!

  3. Click Submit to begin the conversation.


Observe the Conversation in LogsΒΆ

  • The Logs window will display the real-time exchange between Joe and Cathy, where each agent responds based on the previous joke or statement, simulating a standup comedy routine.

Review and Export ResultsΒΆ

  • After the conversation, various CSV logs (e.g., agents.csv, chat_completions.csv) are saved in the file explorer. You can analyze these logs to evaluate the flow and refine the agent interactions.

Skipping user inputΒΆ

To skip user input and directly start the conversation, you can modify the chat link settings to start with a specific message. Set the message type as "Text" and set the desired starting message to the content field. This way, the agents will begin the conversation without waiting for user input.

Skip user input Preview Skip user input Preview

Using a termination conditionΒΆ

You can also disable the "max turns" setting in the chat link and use a termination condition to end the conversation based on specific criteria. Specify the termination settings in each agent's configuration to control the flow's duration and completion.

No max turns preview 1 No max turns preview 1

Also, make sure you update the agents' system messages to reflect the termination condition.

No max turns preview 2 No max turns preview 2


Files used in this example: