MongoDB's GenAI Showcase - Part 1
At some point I came across MongoDB's GenAI Showcase. I recently spent some time exploring the repository, but before I dove in I wanted to get a high-level view of what the repo contained.
The summary for the repo is below — helpful but I was looking for a slightly more specific view.
Whether you are just starting out on your Generative AI journey, or looking to build advanced GenAI applications, we've got you covered. This repository has an exhaustive list of examples and sample applications that cover Retrieval-Augmented Generation (RAG), AI Agents, and industry-specific use cases.
Google Search was not helpful, as it linked to posts where excitement was shared about the repo, with little concrete information.
While I have yet to build out and try any of these notebooks firsthand, I did read through quite a few of them, and will highlight some of them in a short series of posts.
SmolAgents with MongoDB
Stack: MongoDB Atlas, smolagents, Hugging Face
SmolAgents offers two types of agents:
CodeAgents - write their tools calls in Python
ToolCallingAgents - write their tools calls in JSON
In this example, ToolCallingAgents are used. Three agents are created: an inventory_agent, an order_agent, and a delivery_agent, with a manager to coordinate them.
Each agent is given a set of tools, which are simple Python functions with robust docstrings describing what the function does and specifying inputs and outputs. The agents write their tool calls as JSON, specifying the method they will call and the parameters they will pass in.
The manager is in turn provided with a description of what each agent is capable of, and a high-level set of instructions for how to process an order:
For each order:
1. Create the order document
2. Update the inventory
3. Set deliviery status to in_transitAfter inventory is set up, the following order, sending 2 of prod1 and 1 of prod2 to 123 Main St, and 3 of prod3 to 456 Elm St are passed to the manager.
test_orders = [
{
"products": [
{"product_id": "prod1", "quantity": 2},
{"product_id": "prod2", "quantity": 1},
],
"address": "123 Main St",
},
{"products": [{"product_id": "prod3", "quantity": 3}], "address": "456 Elm St"},
]The manager then instructs each agent on what to do; the instructions below are for the order_agent.
You're a helpful agent named 'orders'. You have been submitted this task by your manager. --- Task:
Please create the following order documents: 1. Order with products [{'product_id': 'prod1', 'quantity': 2}, {'product_id': 'prod2', 'quantity': 1}] to be delivered to '123 Main St'. 2. Order with products [{'product_id': 'prod3', 'quantity': 3}] to be delivered to '456 Elm St'.
--- You're helping your manager solve a wider task: so make sure to not provide a one-line answer, but give as much information as possible to give them a clear understanding of the answer.
Your final_answer WILL HAVE to contain these parts: ### 1. Task outcome (short version):
### 2. Task outcome (extremely detailed version):
### 3. Additional context (if relevant):
Put all these in your final_answer tool, everything that you do not pass as an argument to final_answer will be lost.
And even if your task resolution is not successful, please return as much context as possible, so that your manager can act upon this feedback.
{additional_prompting} The manager then gathers all the updates and provides a summary:
### **Processed Orders and Inventory Update**
1. **Orders Created**:
- **Order 1**:
- **Products**:
- `prod1`: 2 units
- `prod2`: 1 unit
- **Delivery Address**: `123 Main St`
- **Order ID**: `677b8a9ff033af3a53c9a75a`
...
### **Summary**:
- The orders have been successfully processed.
- The inventory has been updated to reflect the subtracted quantities.
- The delivery status for both orders is now **"in_transit"**.
Let me know if you need further assistance! 😊Pretty cool!
A conceptual view of the process is below.
As someone just starting to get their hands dirty with agentic AI, this was a straightforward example to wrap my head around.
Now, to try this for myself!

