Conversable Agent
ConversableAgent is at the heart of all AG2 agents while also being a fully functioning agent.
Let's converse with ConversableAgent in just 5 simple steps.
import Example from "/snippets/python-examples/conversableagentchat.mdx";
Let's break it down:
-
Import
ConversableAgent
, you'll find the most popular classes available directly fromautogen
. -
Create our LLM configuration to define the LLM that our agent will use.
-
Create our ConversableAgent give them a unique name, and use
system_message
to define their purpose. -
Ask the agent a question using their
run
method, passing in our starting message.user (to helpful_agent): In one sentence, what's the big deal about AI? -------------------------------------------------------------------------------- >>>>>>>> USING AUTO REPLY... helpful_agent (to user): AI transforms our world with endless potential, enhancing lives and knowledge, truly essential. -------------------------------------------------------------------------------- Replying as user. Provide feedback to helpful_agent. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: