Skip to content

Add Devin (Cognition AI) .NET Sample Agent#298

Open
Yogeshp-MSFT wants to merge 2 commits into
microsoft:mainfrom
Yogeshp-MSFT:Devin-Dotnet-PR
Open

Add Devin (Cognition AI) .NET Sample Agent#298
Yogeshp-MSFT wants to merge 2 commits into
microsoft:mainfrom
Yogeshp-MSFT:Devin-Dotnet-PR

Conversation

@Yogeshp-MSFT
Copy link
Copy Markdown

Summary

Adds a new .NET sample demonstrating how to integrate Devin (by Cognition AI) with the Microsoft Agent 365 SDK. The agent forwards user messages to Devin's autonomous coding API and returns responses via Teams/email notifications.

What this sample demonstrates

  • Devin REST API integration — session creation, follow-up messages, and polling for responses
  • Multi-turn conversations — maintains Devin session across conversation turns
  • Typing indicators — sends periodic typing activity during Devin's long-running operations (10-60s)
  • Install/Uninstall handling — responds to InstallationUpdate activities with welcome/farewell messages
  • OpenTelemetry observability — custom metrics, spans, and A365 tracing integration
  • Agentic + Playground support — dual handler registration for production and local testing

Files added

Path Purpose
Agent/MyAgent.cs Main agent — message routing, typing loop, install/uninstall
Client/DevinClient.cs Devin API client (create session, send message, poll)
telemetry/ OpenTelemetry setup, custom metrics, A365 observability wrapper
Program.cs DI configuration, HTTP client registration, health check
AspNetExtensions.cs JWT token validation for ABS/SMBA
appsettings.json Production config template (placeholder values)
appsettings.Playground.json Local dev config template

Prerequisites

  • .NET 8.0+
  • Devin API key (app.devin.ai)
  • A365 blueprint credentials (via a365 setup blueprint)

Copilot AI review requested due to automatic review settings May 4, 2026 10:30
@Yogeshp-MSFT Yogeshp-MSFT requested a review from a team as a code owner May 4, 2026 10:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new .NET 8 sample agent that integrates with Cognition AI’s Devin API using the Microsoft Agent 365 SDK, including basic hosting setup, configuration templates, and an OpenTelemetry-based telemetry layer.

Changes:

  • Added a Devin REST API typed client plus a new MyAgent implementation that forwards user messages to Devin and returns results.
  • Introduced OpenTelemetry configuration and custom metrics/tracing helpers for agent and HTTP operations.
  • Added sample documentation and local launch/config templates for “production” vs “Playground” execution.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
dotnet/devin/sample-agent/telemetry/AgentOTELExtensions.cs Configures OpenTelemetry resource, metrics, and tracing instrumentation for the sample.
dotnet/devin/sample-agent/telemetry/AgentMetrics.cs Defines custom counters/histograms and Activity helpers intended to wrap agent/HTTP operations.
dotnet/devin/sample-agent/telemetry/A365OtelWrapper.cs Adds an A365 observability wrapper intended to register tenant/agent baggage and tokens.
dotnet/devin/sample-agent/README.md Documents sample purpose, configuration, and usage guidance.
dotnet/devin/sample-agent/Properties/launchSettings.json Adds launch profiles for normal vs Playground runs.
dotnet/devin/sample-agent/Program.cs Wires DI, authentication, telemetry, and maps the /api/messages endpoint.
dotnet/devin/sample-agent/DevinSampleAgent.csproj Defines the web project and NuGet dependencies for A365 + telemetry.
dotnet/devin/sample-agent/Client/DevinClient.cs Implements Devin session creation, follow-up messaging, and polling logic.
dotnet/devin/sample-agent/AspNetExtensions.cs Adds JWT token validation configuration helpers for ABS/SMBA-style scenarios.
dotnet/devin/sample-agent/appsettings.Playground.json Provides Playground-oriented config template (incl. Devin settings).
dotnet/devin/sample-agent/appsettings.json Provides main config template (AgentApplication, Devin, connections, observability).
dotnet/devin/sample-agent/Agent/MyAgent.cs Implements message + install/uninstall handling and typing indicators.
dotnet/devin/sample-agent/.gitignore Ignores local secrets/overrides and build outputs for the sample.

Comment thread dotnet/devin/sample-agent/telemetry/AgentMetrics.cs
Comment thread dotnet/devin/sample-agent/telemetry/AgentMetrics.cs
Comment thread dotnet/devin/sample-agent/telemetry/AgentMetrics.cs
Comment thread dotnet/devin/sample-agent/telemetry/AgentOTELExtensions.cs
Comment thread dotnet/devin/sample-agent/telemetry/AgentOTELExtensions.cs
Comment thread dotnet/devin/sample-agent/Client/DevinClient.cs
Comment thread dotnet/devin/sample-agent/Client/DevinClient.cs
Comment thread dotnet/devin/sample-agent/Agent/MyAgent.cs
Comment thread dotnet/devin/sample-agent/README.md Outdated
@Yogeshp-MSFT
Copy link
Copy Markdown
Author

HI @ajmfehr can you review and approve this pr?

Yogeshp-MSFT and others added 2 commits May 8, 2026 16:54
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@Yogeshp-MSFT
Copy link
Copy Markdown
Author

Hi @microsoft/agent365-approvers @ajmfehr , could you review this PR for merging?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants