Join the DZone community and get the full member experience.
Join For Free
In this article, we will run some basic Artificial Intelligence (AI) Python code using the Databricks Community Edition (CE), a free, cloud-based platform. Since we are dealing with open-source libraries only, this experiment can be easily reproduced in any Python/PySpark environment.
AutoGen is an open-source platform that enables us to create collaborative AI agents. These agents work together to accomplish tasks, often by interacting through a group chat. A conversable agent can send, receive, and generate messages. It can also be customized using a combination of AI models, tools, and human input. A conversable agent can be any of the following:
We will create a group chat between a user proxy agent (e.g., a Head of Architecture) and three assistant agents: a Cloud Architect, an open-source (OSS) Architect, and a Lead Architect. The objective would be to provide a solution architecture based on a list of business requirements. We can represent this in the following diagram of interactions:
Let's create the prompts first, starting with the common piece (the task at hand) that contains some simple requirements:
Once we have completed the prompts, we can start creating our conversable agents and having them interact in a chat setting.
We start with the imports and some configurations. We could work with multiple models, but we are choosing to use only GPT-4o in this simple example.
A zero minimizes the randomness of the model, concentrating on the most likely (i.e., highest-scoring) choices. We will now create our agents with their specific prompts:
The code above should be self-explanatory. Before starting the chat, we need to specify an order of interaction since we want the Lead Architect to go last when the other two assistants have already provided their solutions. The Lead will need to review those and decide. To make sure that this order is followed, we create a function to be used in the chat for speaker selection:
This is a simple example of a Finite State Machine (FSM). We are now ready to trigger the chat with this last bit of code:
Due to space considerations, we will show only excerpts of the output. The code is straightforward to replicate, and those interested in the details can run it directly in their own environments.
The cloud agent then lists relevant services with each cloud provider based on the requirements provided, explains the advantages of the cloud over on-premises, and presents a summary table.
Finally, the lead agent steps in, analyzes the advantages and disadvantages of each solution, uses a suitability matrix, etc., and communicates its final recommendations:
Note that any opinion expressed by the lead agent remains its own and does not necessarily reflect the opinion of the author of this article.
Using a fairly simple setup, we created a basic architecture team organization where different types of participants collaborate to provide solutions to the business.
Of course, architecture involves more than just providing technical recommendations. Architects often deal with complex, unique challenges that require a deep understanding of business needs and thinking critically about long-term implications. There are intangible factors that AI may not fully grasp, lacking the necessary interpersonal skills and emotional intelligence... at least for now.