Building a Custom Engine Agent with Vertex AI for Microsoft 365 Copilot

How to design a backend-owned Copilot agent and integrate Google Vertex AI cleanly across cloud boundaries.


Introduction

Extending Microsoft 365 Copilot often starts with declarative agents or lightweight plugins. That works well—until you need full control.

In this project, the goal was different:

  • keep orchestration inside a backend we fully own
  • integrate an external model provider (Google Vertex AI)
  • expose the result through Microsoft 365 surfaces like Teams and Copilot

This led to a Custom Engine Agent architecture, where:

Microsoft handles the channel.
Your backend owns the behavior.

This article focuses on two key areas:

  • how to structure a Custom Engine Agent properly
  • how to integrate Vertex AI as a first-class backend component

Why a Custom Engine Agent?

Instead of a declarative setup, the system is built as a backend-driven agent that can:

  • accept activities from Teams or Copilot
  • orchestrate prompt preparation in C#
  • call Vertex AI directly
  • persist generated assets and metadata
  • expose public download URLs
  • evolve independently of Microsoft 365 packaging

The key architectural decision:

Keep Microsoft 365 at the boundary — everything else is regular backend code.


High-Level Architecture

Copilot / Teams
Custom Engine Agent host (Microsoft Agents SDK)
Agent (activity → domain translation)
Engine (use case logic)
Orchestrator (prompt preparation)
Vertex AI client
Storage (assets + metadata)
Response (image + URL)

Key design rule

  • Host → thin
  • Agent → channel-aware
  • Engine → business logic
  • Vertex client → provider integration
Continue reading “Building a Custom Engine Agent with Vertex AI for Microsoft 365 Copilot”

From Declarative Agent to Source-Grounded Legal Copilot

When teams first introduce a Microsoft 365 declarative agent into an existing system, the goal is usually straightforward: expose backend capabilities through a Copilot-friendly interface.

That’s useful—but not yet transformative.

The real shift happens when the agent stops being just a thin wrapper over an API and starts driving interaction based on grounded evidence. Instead of returning only an answer, the system begins suggesting the next valid step—and does so deterministically, based on real legal sources.

This article walks through that transition from an engineering perspective.


The problem with “one-shot” Copilot interactions

A typical declarative agent interaction looks like this:

  • The user asks a question
  • The backend returns an answer
  • Sources are displayed
  • The conversation stops

At that point, the burden shifts back to the user: What should I ask next?

In domains like legal or policy workflows, this is a serious limitation. The system already has the context, the sources, and the structure—but the interaction model doesn’t leverage it.

The challenge becomes:

How do we guide the user forward without letting the model improvise or hallucinate the next step?


Design goals

The solution was built around a few strict constraints:

  • Only generate follow-up prompts when they can be grounded in real legal sources
  • Keep the API contract stable (no Copilot-specific hacks)
  • Make prompts directly actionable in the UI
  • Avoid redundant or repeated suggestions

This leads to a key principle:

The system should not invent the next step. It should derive it from evidence.


Architecture overview

The implementation builds on top of an existing “rich answer” pipeline.

High-level flow:

  1. Backend returns an answer (text + sources)
  2. A parser extracts structured data from the response
  3. Source metadata is analyzed
  4. A prompt builder evaluates whether grounded suggestions can be generated
  5. If conditions are met → prompts are emitted
  6. UI renders them as clickable actions

This keeps the system data-first:

  • Backend = logic + structure
  • UI = rendering only

No hidden heuristics in the frontend.

Continue reading “From Declarative Agent to Source-Grounded Legal Copilot”

Website Powered by WordPress.com.

Up ↑