Corporate Intelligence Harness

Collapse the research. Secure the execution.

Corporate Intelligence Harness is a Qwen-powered, multi-agent financial intelligence system that transforms live market data, SEC filings, and portfolio context into adversarial investment research. It can also prepare simulated or broker-backed trades, while keeping execution protected by explicit human approval.


💡 Inspiration

Investment research is fragmented.

Answering a seemingly simple question such as “Should I buy Tesla?” often means moving between market-data dashboards, SEC filings, portfolio spreadsheets, research notes, and brokerage tools. Each source provides part of the picture, but the investor must still reconcile conflicting evidence, remember existing portfolio exposure, and decide whether a recommendation is safe to execute.

I wanted to build something that did more than summarize a stock ticker. The system should gather evidence, challenge its own conclusions, remember conversational context, evaluate portfolio risk, and safely connect research to action.

That idea became Corporate Intelligence Harness: an agentic control layer that collapses a fragmented research process while keeping execution accountable.




🎯 What it does

Corporate Intelligence Harness accepts natural-language financial questions and routes them through specialized workflows.

A user can begin with:

Analyze Tesla.

Qwen classifies the request and selects one of four LangGraph paths:

  • Research analysis
  • Direct trade
  • Portfolio review
  • General financial Q&A


Adversarial Investment Research

For research requests, the harness retrieves live market and fundamental data through Yahoo Finance MCP and supplements it with recent SEC EDGAR filings.

The same evidence is then supplied to an adversarial investment committee:

  • The Bull Analyst presents the strongest evidence-supported case.
  • The Bear Auditor challenges the thesis and identifies downside risk.
  • The Portfolio Director evaluates both positions and produces the final verdict.

Bull and Bear agents run concurrently across multiple debate rounds. The Portfolio Director returns a structured verdict containing a recommendation, confidence score, supporting arguments, key risks, and unresolved dissent.

The report includes source references so users can verify the underlying evidence rather than accepting an unsupported recommendation.



Conversational Memory

The harness retains recent conversational context.

After asking about Tesla, the user can follow up with:

How does profitability compare with its competitors?

The user does not need to repeat the company name or ticker. Qwen resolves the reference to Tesla, identifies relevant competitors, and coordinates the required data retrieval and comparison.



Portfolio Risk Auditing

The system evaluates investments in the context of the user’s existing portfolio.

Reusable skills analyze:

  • Asset allocation
  • Single-stock concentration
  • Sector exposure
  • Correlation risk
  • Volatility
  • Liquidity
  • Stop-loss conditions
  • Take-profit conditions

Portfolio concentration is measured using the Herfindahl-Hirschman Index:

HHI = Σi=1N si2

Here, si represents the allocation weight of the i-th portfolio holding.

A portfolio dominated by one position produces a higher HHI and a stronger concentration warning. This allows the system to distinguish between an attractive stock and a trade that would create excessive portfolio exposure.



Human-Approved Trading

Direct BUY or SELL requests are parsed into structured pending trades and checked against pre-trade risk rules.

The initial graph run never executes the order. Instead:

  1. trading_node creates a pending trade request.
  2. The backend stores the request after the graph completes.
  3. The user approves or rejects it through the interface.
  4. A separate execution endpoint verifies the approval.
  5. The approved order is routed to paper trading or Robinhood MCP.

Rejected or unapproved requests cannot reach the broker.




🛠️ How we built it

The application is organized into specialized layers that separate reasoning, orchestration, external tools, execution, and presentation.


Qwen Intelligence

Qwen performs intent classification, contextual entity resolution, financial reasoning, agent debate, and structured verdict generation.

  • Qwen 3.6 Flash handles triage and routing.
  • Qwen 3.7 Plus handles research, portfolio analysis, and investment committee reasoning.

Structured output schemas constrain routing decisions and committee verdicts, ensuring that downstream code receives predictable data instead of unrestricted model responses.



LangGraph Orchestration

LangGraph provides the application’s explicit control plane.

A typed graph state carries the user request, conversation history, ticker, routing decision, research evidence, portfolio context, generated report, and approval state between nodes.

Conditional edges route requests through research, direct trade, portfolio review, or general Q&A. Deterministic nodes enforce workflow and execution boundaries around Qwen’s reasoning.



MCP and Financial Evidence

Yahoo Finance MCP provides live quote and fundamental data through a persistent stdio connection.

SEC EDGAR supplies recent filing metrics such as revenue, net income, cash, debt, and free cash flow.

Robinhood MCP is available behind the broker abstraction for optional live execution. MockSimulationEngine provides a safer paper-trading path for public deployments and demonstrations.



Adversarial Investment Committee

Every committee member receives the same evidence contract.

The Bull and Bear agents run concurrently during each debate round, reducing latency while preserving independent arguments. The Portfolio Director then evaluates the complete transcript and returns a machine-readable verdict.

This separation prevents each persona from selecting a different set of facts to support its assigned position.



API and Interface

The frontend is built with Streamlit and communicates with a FastAPI backend.

FastAPI executes the LangGraph workflow and streams progress events as newline-delimited JSON. Streamlit consumes those events to display routing, tool activity, committee progress, reports, citations, portfolio state, and approval controls.



Alibaba Cloud

The FastAPI backend runs serverlessly on Alibaba Cloud Function Compute using a custom Python runtime.

Qwen is accessed through DashScope’s OpenAI-compatible endpoint. The Streamlit frontend is deployed separately and communicates with the Alibaba-hosted backend over HTTPS.




⚡ Challenges we ran into

Grounding Multiple Agents

Assigning different personas to Bull and Bear agents can encourage each model to exaggerate evidence in support of its position.

I addressed this by creating one shared evidence contract that every committee member receives. The personas are instructed to reason only from that payload and cite the supplied values.



Preserving Conversational Context

Follow-up questions frequently omit the company name or ticker.

Passing recent conversation history into triage and general Q&A required careful state design so Qwen could resolve ambiguous references without allowing old context to override a new request.



Streaming a Synchronous Workflow

LangGraph execution is synchronous, while FastAPI streaming is asynchronous.

I bridged the two with a background worker and event queue. This allows the frontend to receive progress updates while the graph continues running.



Separating Approval from Execution

Human approval occurs after the initial graph request has completed.

I separated the process into pending-trade storage, approval, and execution APIs. The execution endpoint independently verifies that a request exists and was approved before contacting a broker.



Serverless and Model Latency

A full research request invokes several model calls: triage, two rounds of Bull and Bear analysis, and a Portfolio Director verdict.

Individual Qwen calls typically take 7–20 seconds. External data retrieval, expanding debate context, and serverless cold starts can bring a complete research workflow to approximately 2–3 minutes.

The interface streams progress throughout this process so users can see what the system is doing instead of waiting on a blank screen.




🏆 Accomplishments that we're proud of

  • Built a functional four-path agentic workflow rather than a single prompt wrapper.
  • Implemented an adversarial Bull, Bear, and Portfolio Director committee.
  • Grounded every committee member in the same financial evidence.
  • Added conversational entity resolution for ambiguous follow-up questions.
  • Connected investment research to portfolio-aware risk analysis.
  • Implemented explicit post-run approval before trade execution.
  • Created one broker interface for paper trading and optional Robinhood MCP execution.
  • Added source visibility and live workflow progress to the frontend.
  • Deployed the Qwen-powered backend on Alibaba Cloud Function Compute.
  • Created a structured comparison workflow for company competitors and profitability metrics.




🎓 What we learned

Agentic Systems Need Structure

Agentic behavior is not created simply by adding more model calls.

Reliable agentic systems require clear responsibilities, controlled shared state, constrained tool access, and deterministic boundaries around consequential actions.



Disagreement Requires Shared Facts

The Bull and Bear debate became substantially more useful once both agents were grounded in the same evidence.

Without a shared evidence contract, adversarial personas may strengthen their arguments by drifting toward different or unsupported facts.



Human Approval Is a Workflow

Human-in-the-loop execution is more than a confirmation button.

It requires a durable request identity, explicit state transitions, independent approval verification, and a broker boundary that cannot be bypassed by model output.



MCP and LangGraph Solve Different Problems

MCP standardizes access to external capabilities such as market data and broker operations.

LangGraph controls application state, routing, and workflow order. Qwen provides the reasoning that operates within those boundaries.

Together, these layers create a system that is flexible without surrendering control.




🚀 What's next for Corporate Intelligence Harness

Persistent Workflow State

Pending trades and approval decisions currently use in-memory storage.

The next version will persist this state in a database and introduce LangGraph checkpointing so workflows can resume safely across restarts and serverless instances.



Lower-Latency Research

Future optimizations will include:

  • Short-lived caching for market data
  • Longer-lived caching for SEC filings
  • Faster models for Bull and Bear analysis
  • Streaming model output to the frontend
  • Reduced debate rounds for interactive requests
  • Parallel portfolio price retrieval



Evaluation and Benchmarking

The project will add repeatable evaluation datasets for:

  • Routing accuracy
  • Citation correctness
  • Committee consistency
  • Portfolio-risk detection
  • Approval-boundary enforcement
  • Multi-agent versus single-agent decision quality



Broader Financial Evidence

Future research workflows will support additional SEC filing types, financial statements, news evidence, and historical comparisons.



Enterprise Collaboration

The harness can evolve beyond a standalone portal into collaborative financial workflows.

Potential integrations include secure webhooks, internal approval dashboards, portfolio alerts, scheduled research summaries, and asynchronous investment committee reviews.

The long-term goal is not to remove humans from financial decisions. It is to give them better evidence, clearer disagreement, stronger risk controls, and a safer path from research to execution.

Built With

Share this project:

Updates