How to Integrate AutoGen for investment banking with Docker for RAG
AutoGen for investment banking gives you a structured way to coordinate multiple agents around research, analysis, and decision support. Docker gives you a clean runtime boundary for your RAG stack so the same pipeline can run locally, in CI, or inside a controlled bank environment.
Put them together and you get an agent system that can query internal deal docs, run retrieval against a containerized vector store, and keep the orchestration logic separate from the infrastructure. That matters when you need repeatable compliance checks, auditable outputs, and a deployment model that ops teams will actually approve.
Prerequisites
- •Python 3.10+
- •Docker Desktop or Docker Engine installed and running
- •
pipaccess to install Python packages - •An OpenAI-compatible model endpoint or Azure OpenAI configured for AutoGen
- •A local RAG backend running in Docker, such as:
- •PostgreSQL + pgvector
- •Qdrant
- •Chroma
- •Basic familiarity with:
- •
autogen.Agent - •
autogen.GroupChat - •
docker.from_env() - •REST calls from Python
- •
Install the Python dependencies:
pip install pyautogen docker requests
Integration Steps
1) Start your RAG service in Docker
For investment banking workflows, keep your document store isolated in a container. Here’s a minimal example using Qdrant.
import docker
client = docker.from_env()
container = client.containers.run(
"qdrant/qdrant:latest",
name="ib-rag-qdrant",
detach=True,
ports={"6333/tcp": 6333},
environment={"QDRANT__SERVICE__HTTP_PORT": "6333"},
)
print(container.id)
This uses the Docker SDK’s from_env() client and containers.run() method to launch the vector database. In production, you’d pin the image tag and attach it to a dedicated network.
2) Index investment banking documents into the RAG store
Next, load your deal materials into the containerized retrieval layer. This example uses Qdrant’s HTTP API directly so you can see the integration clearly.
import requests
docs = [
{
"id": 1,
"text": "Company A reported EBITDA of $120M with guidance for 12% growth.",
},
{
"id": 2,
"text": "The acquisition target has recurring revenue concentration risk in two clients.",
},
]
for doc in docs:
payload = {
"points": [
{
"id": doc["id"],
"vector": [0.1] * 1536,
"payload": {"text": doc["text"]},
}
]
}
r = requests.put(
"http://localhost:6333/collections/ib_deals/points?wait=true",
json=payload,
timeout=30,
)
print(r.status_code, r.text)
In a real setup, replace the dummy vector with embeddings from your embedding model. The important part is that your retrieval layer now sits behind Docker and can be recreated reliably.
3) Configure AutoGen agents for banking analysis
AutoGen’s core pattern is still the same: define agents, give them roles, then let them collaborate. For banking use cases, I usually separate research from analysis so every answer has a traceable source path.
import autogen
config_list = [
{
"model": "gpt-4o-mini",
"api_key": "YOUR_OPENAI_API_KEY",
}
]
llm_config = {
"config_list": config_list,
"temperature": 0,
}
researcher = autogen.AssistantAgent(
name="researcher",
llm_config=llm_config,
)
analyst = autogen.AssistantAgent(
name="analyst",
llm_config=llm_config,
)
user_proxy = autogen.UserProxyAgent(
name="user_proxy",
human_input_mode="NEVER",
)
This uses AutoGen’s AssistantAgent and UserProxyAgent classes directly. Keep temperature at zero for repeatable outputs when you’re summarizing deal data or drafting investment committee notes.
4) Connect AutoGen to Docker-backed retrieval
Now wire retrieval into the agent flow. The simplest production pattern is: user asks a question, agent calls your Python tool, tool queries the containerized RAG service, then returns grounded context back to AutoGen.
import requests
def retrieve_context(query: str) -> str:
response = requests.post(
"http://localhost:6333/collections/ib_deals/points/scroll",
json={
"limit": 5,
"with_payload": True,
"with_vectors": False,
},
timeout=30,
)
response.raise_for_status()
points = response.json().get("result", {}).get("points", [])
snippets = [p["payload"]["text"] for p in points]
return "\n".join(snippets)
def banking_rag_reply(message: str) -> str:
context = retrieve_context(message)
return f"""Use this context to answer:
{context}
Question: {message}
"""
chat_result = user_proxy.initiate_chat(
analyst,
message=banking_rag_reply("What risks stand out in Company A's acquisition?"),
)
print(chat_result)
The key method here is UserProxyAgent.initiate_chat(), which triggers the conversation. In practice, I’d wrap retrieval as an AutoGen tool/function and let the assistant call it explicitly, but this pattern is enough to prove end-to-end connectivity.
5) Add orchestration for multi-agent review
For investment banking, one agent should not be final authority on a deal summary. Use group chat so one agent drafts and another validates against retrieved evidence.
groupchat = autogen.GroupChat(
agents=[user_proxy, researcher, analyst],
messages=[],
max_round=6,
)
manager = autogen.GroupChatManager(
groupchat=groupchat,
llm_config=llm_config,
)
user_proxy.initiate_chat(
manager,
message="Review the target company risks using retrieved deal documents and produce a concise IC summary.",
)
GroupChat plus GroupChatManager gives you a clean review loop. That matters when analysts need source-backed summaries before sending material to bankers or compliance.
Testing the Integration
Run this quick verification script after starting Docker and indexing at least one document.
import docker
import requests
client = docker.from_env()
container = client.containers.get("ib-rag-qdrant")
print("running:", container.status)
r = requests.get("http://localhost:6333/collections", timeout=30)
print("qdrant:", r.status_code)
sample_query = requests.post(
"http://localhost:6333/collections/ib_deals/points/scroll",
json={"limit": 1, "with_payload": True},
timeout=30,
)
print(sample_query.json())
Expected output:
running: running
qdrant: 200
{'result': {'points': [{'payload': {'text': 'Company A reported EBITDA of $120M with guidance for 12% growth.'}}]}}
If that works, Docker is hosting your retrieval layer correctly and AutoGen can consume its results through your Python integration code.
Real-World Use Cases
- •Drafting investment committee memos from internal CIMs, earnings decks, and diligence notes stored in Dockerized vector databases.
- •Building an analyst copilot that answers questions like “what changed since last quarter?” using AutoGen agents plus retrieved filings.
- •Running compliance-aware deal review workflows where one agent summarizes and another checks claims against source documents before anything leaves the system.
Keep learning
- •The complete AI Agents Roadmap — my full 8-step breakdown
- •Free: The AI Agent Starter Kit — PDF checklist + starter code
- •Work with me — I build AI for banks and insurance companies
By Cyprian Aarons, AI Consultant at Topiax.
Want the complete 8-step roadmap?
Grab the free AI Agent Starter Kit — architecture templates, compliance checklists, and a 7-email deep-dive course.
Get the Starter Kit