Back to thinking
AILLMsPythonAgentic WorkflowsStellula

Beyond the Chatbot: Building Agentic Workflows for Real-World Due Diligence

Why 'Chat with PDF' isn't enough for business strategy, and how we engineered Python-based AI Agents to automate complex investment analysis.

In the last year, "RAG" (Retrieval-Augmented Generation) became the buzzword of the industry. Every company built a "Chat with your Data" prototype. You upload a PDF, ask a question, and the bot answers.

For 90% of use cases, that's fine. But when we started building the technical infrastructure for Stellula, a Venture Builder focused on high-stakes investment decisions, "fine" wasn't enough.

We needed to automate due diligence, a process that requires skepticism, cross-referencing, and multi-step reasoning. A simple chatbot would just summarize the founder's pitch deck. We needed an agent that could interrogate it.

Here is how we moved beyond simple RAG to build agentic workflows using Python and LLMs.

The Problem with "One-Shot" Inference

If you paste a 50-page financial report into an LLM and ask "Is this a good investment?", you will get a generic, hallucinated, or overly optimistic answer.

LLMs are probabilistic engines, not truth machines. If you give them a complex task in a single prompt, they tend to "lazy reason": they take the path of least resistance.

To solve this, we stopped treating the LLM as an oracle and started treating it as a processor within a larger architecture.

The Agentic Architecture

Instead of one giant prompt, we architected a workflow of specialized agents. A manufacturing line of thought.

1. The Decomposition Agent

The first step isn't answering the question. It's understanding it. When a user asks "Analyze this startup," our first agent breaks this down into strict sub-tasks:

  • "Extract the Market Size claims."
  • "Identify the Competitors mentioned."
  • "Calculate the burn rate based on the P&L."

2. The Researcher (Tool Use)

This is where Python shines. The LLM identifies what it needs, but Python executes the retrieval. We gave the agents tools beyond vector search: precise math and structured data extraction.

This separates "creative writing" (LLM) from "fact-checking" (Code).

3. The Critic (Self-Correction)

This was our breakthrough. We introduced a "Critic Agent" whose only job is to review the output of the "Researcher Agent."

  • Researcher: "The company grew 300% YoY."
  • Critic: "Citation needed. Please point to the specific page in the document or flag this as an assumption."

This loop cut more hallucinations than any prompt tweak we tried. It mimics a Senior Engineer reviewing a Junior's PR.

Structured Output is King

One major lesson: never let the LLM just "talk".

At the end of the workflow, we force the output into strict JSON schemas (using libraries like Pydantic). We don't want a poem about the startup's finances; we want a structured object that our frontend can render as charts and risk scores.

Architecture Over Prompts

The transition from "Senior Engineer" to "AI Engineer" has little to do with writing clever prompts. It means applying software engineering principles (modularity, testing, separation of concerns) to non-deterministic models.

At Stellula, the magic was never the model, GPT-4 or Claude. The magic is the workflow that orchestrates the model to produce reliable, business-critical outputs.

Chatting with AI is the demo. Delegating work to it is the product.