Agent365-Samples
CLAUDE.md113 starsChanged 24 days agoMITView on GitHub
This is the Agent365-Samples repository containing sample agents demonstrating the Microsoft Agent 365 SDK across three languages (C#/.NET, Python, Node.js/TypeScript) and multiple AI orchestrators (OpenAI, Claude, Semantic Kernel, Agent Framework, LangChain, CrewAI, etc.). The Microsoft Agent 365 SDK extends the Microsoft 365 Agents SDK with enterprise-grade capabilities for observability, notifications, MCP tooling, and runtime utilities. Each language directory contains a docs/design.md with language-specific design patterns. Solutions: - dotnet/agent-framework/AgentFrameworkSample.sln - dotnet/semantic-kernel/SemanticKernelSampleAgent.sln Python samples use pyproject.toml for dependency management. Most samples support…
- Reads credentials
- Installs packages
In this repository2 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- generate-readmeSkill
The file
We split this CLAUDE.md into the rules it gives an agent
9 rules. About 0 are common, 7 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 123
All sample agents follow a consistent initialization and message processing flow:
- Very specific: line 131
Start HTTP server (listen on /api/messages)
- Distinctive: line 135
Observability Context Setup: Start trace span, set baggage (tenant, agent, conversation)
- Distinctive: line 162
All samples integrate Microsoft Agent 365 observability:
- Distinctive: line 198
All source files MUST have Microsoft copyright headers:
- Distinctive: line 227
Never use "Kairo" in code - this is a legacy reference that should be replaced with appropriate Agent 365 terminology.
- Distinctive: line 230
Never commit API keys, tokens, or secrets
- Very specific: line 231
Use placeholders like <<YOUR_API_KEY>> or <<PLACEHOLDER>> in config examples
- Distinctive: line 232
Use environment variables, user secrets, or key vaults for sensitive data
≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Repository Overview
This is the Agent365-Samples repository containing sample agents demonstrating the Microsoft Agent 365 SDK across three languages (C#/.NET, Python, Node.js/TypeScript) and multiple AI orchestrators (OpenAI, Claude, Semantic Kernel, Agent Framework, LangChain, CrewAI, etc.).
The Microsoft Agent 365 SDK extends the Microsoft 365 Agents SDK with enterprise-grade capabilities for observability, notifications, MCP tooling, and runtime utilities.
Repository Structure
Agent365-Samples/
├── dotnet/ # C#/.NET samples
│ ├── agent-framework/ # Agent Framework orchestrator
│ └── semantic-kernel/ # Semantic Kernel orchestrator
├── python/ # Python samples
│ ├── agent-framework/
│ ├── openai/
│ ├── claude/
│ ├── crewai/
│ └── google-adk/
├── nodejs/ # Node.js/TypeScript samples
│ ├── openai/
│ ├── claude/
│ ├── langchain/
│ ├── devin/
│ ├── n8n/
│ ├── perplexity/
│ └── vercel-sdk/
├── agent-platforms/ # Agent platform samples (deployed into a SaaS platform)
│ └── salesforce/ # Salesforce/Apex samples (SFDX projects)
│ └── apex-observability/ # Native Apex Agent 365 observability + tool boundary
├── docs/ # Repository-wide documentation
│ └── design.md # Architectural patterns
├── prompts/ # AI development prompts
└── scripts/ # Utility scriptsEach language directory contains a docs/design.md with language-specific design patterns.
Common Development Commands
C# / .NET
Build:
dotnet build <path-to-sln-or-csproj>Run:
dotnet run --project <path-to-csproj>Solutions:
dotnet/agent-framework/AgentFrameworkSample.slndotnet/semantic-kernel/SemanticKernelSampleAgent.sln
Python
Setup:
cd <sample-directory>
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -e .Run:
python host_agent_server.py
# or
python start_with_generic_host.pyPython samples use pyproject.toml for dependency management. Most samples support uv for faster dependency resolution.
Salesforce / Apex
Salesforce samples are SFDX projects (no hosted process). Use the Salesforce CLI (sf).
Validate (no persist):
cd agent-platforms/salesforce/<sample-directory>
sf project deploy start --source-dir force-app/main/default --target-org <alias> --dry-run --test-level RunLocalTestsDeploy:
sf project deploy start --source-dir force-app/main/default --target-org <alias> --test-level RunLocalTestsTest:
sf apex run test --target-org <alias> --test-level RunLocalTests --wait 10RunLocalTests enforces 75% aggregate org coverage. Full Apex tests require a Dev Hub + scratch org.
Node.js / TypeScript
Setup:
cd <sample-directory>
npm installBuild:
npm run buildRun:
npm start # Production mode
npm run dev # Development mode with hot reloadArchitecture Patterns
All sample agents follow a consistent initialization and message processing flow:
Initialization Flow
- Load configuration (environment variables, config files)
- Configure observability (Agent 365 tracing/telemetry)
- Initialize LLM client (orchestrator-specific)
- Register tools (local tools + MCP servers)
- Configure authentication (bearer token or auth handlers)
- Start HTTP server (listen on
/api/messages)
Message Processing Flow
- Authentication: JWT validation / auth handlers
- Observability Context Setup: Start trace span, set baggage (tenant, agent, conversation)
- Tool Registration: Load MCP servers and local tools
- LLM Invocation: Process with AI orchestrator
- Response: Stream or send response
- Cleanup: Close connections, end spans
Authentication Strategies
Authentication is configured in this priority order:
- Bearer Token (development): Set
BEARER_TOKENenvironment variable - Auth Handlers (production): Configured in
appsettings.json(C#),.env(Python/Node.js) - No Auth (fallback): Bare LLM mode with graceful degradation
Configuration Files
- C#:
appsettings.json,appsettings.Development.json - Python:
.env,pyproject.toml - Node.js:
.env,package.json
Configuration typically includes:
- LLM client settings (OpenAI/Azure OpenAI endpoints and API keys)
- Observability settings (Agent 365 tracing)
- Authentication settings (bearer token or auth handlers)
- MCP tooling configuration
Observability
All samples integrate Microsoft Agent 365 observability:
- Token caching for agentic auth tokens
- Baggage propagation (tenant, agent, conversation IDs)
- Framework-specific instrumentation (OpenTelemetry)
- Custom span attributes for tracing
MCP (Model Context Protocol) Tooling
Agents can dynamically load tools from MCP servers:
- Tools are configured per agent identity
- Authentication flows through the same mechanism as the agent
- Samples demonstrate both local tools (weather, datetime) and remote MCP servers (Graph API)
Key Code Locations
C# / .NET
- Entry point:
Program.cs - Agent implementation:
Agent/MyAgent.cs(or similar) - Tools:
Tools/directory - Configuration:
appsettings.json
Python
- Entry point:
host_agent_server.pyorstart_with_generic_host.py - Agent implementation:
agent.py - Configuration:
.envor embedded inpyproject.toml
Node.js / TypeScript
- Entry point:
src/index.ts - Agent implementation:
src/agent.ts - LLM client:
src/client.ts - Token cache:
src/token-cache.ts - Configuration:
.env
Code Quality Rules
Copyright Headers
All source files MUST have Microsoft copyright headers:
C# (.cs):
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.Python (.py):
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.JavaScript/TypeScript (.js, .ts):
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.Apex (.cls):
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.Exclusions: Auto-generated files, test files, configuration files (.json, .yaml, .md), and third-party code.
Legacy Reference Check
Never use "Kairo" in code - this is a legacy reference that should be replaced with appropriate Agent 365 terminology.
Security
- Never commit API keys, tokens, or secrets
- Use placeholders like
<<YOUR_API_KEY>>or<<PLACEHOLDER>>in config examples - Use environment variables, user secrets, or key vaults for sensitive data
Sample Documentation Standards
Each sample SHOULD have:
- README.md with:
- What the sample demonstrates
- Prerequisites (runtime version, API keys, tools)
- Configuration section with example config snippets
- How to run instructions
- Testing options (Playground, WebChat, Teams/M365)
- Troubleshooting section
- Agent Code Walkthrough (optional but recommended)
- manifest/ folder with:
manifest.json(Teams app manifest)color.png(192x192 icon)outline.png(32x32 icon)
Technology Stack
| Component | C#/.NET | Python | Node.js/TypeScript |
| HTTP Server | ASP.NET Core | aiohttp/FastAPI | Express.js |
| LLM Client | Azure.AI.OpenAI | openai/anthropic | @openai/agents |
| Observability | OpenTelemetry | OpenTelemetry | OpenTelemetry |
| Agent 365 SDK | Microsoft.Agents.* | microsoft_agents.* | @microsoft/agents-* |
Additional Documentation
- Main README: Overview and links to SDK documentation
- Architecture Design: Cross-cutting architectural patterns
- Contributing Guide: How to contribute
- Copilot Instructions: Automated code review rules
For language-specific design patterns, see:
- .NET Design Guidelines
- Python Design Guidelines
- Node.js Design Guidelines
Official Documentation
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

