Skip to content

Commit ff33d92

Browse files
committed
Integrate SDK docs into the platform docs
1 parent 5845463 commit ff33d92

2 files changed

Lines changed: 151 additions & 2 deletions

File tree

msteams-platform/agents-in-teams/build-first-agent.md

Lines changed: 143 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,154 @@
11
---
22
title: Create your first agent
3-
description: Learn how to build your agent in Microsoft Teams with the help of GitHub codespaces that opens Toolkit extension and step-by-step guides.
3+
description: Learn how to build your agent in Microsoft Teams with the Teams SDK and
44
ms.localizationpriority: high
5-
ms.date: 12/11/2024
5+
ms.date: 05/17/2026
66
ms.topic: reference
7+
zone_pivot_groups: developer-tooling
78
---
89

910
# Build your first agent
1011

1112
Agents utilize AI to automate and execute business processes, functioning alongside or on behalf of a person, team, or organization. Agents range from simple prompt-and-response agents to more advanced, fully autonomous agents.
1213

14+
::: zone pivot="teams-developer-cli"
15+
16+
## Prerequisites
17+
18+
- Node.js 20 or later
19+
- Microsoft Teams, logged in to a Microsoft 365 account with **custom app upload (sideloading) enabled** on the tenant. Step 2 will check this.
20+
- `devtunnel`, a free, cross-platform tool that enables developers to seurely expose local web services from a developer environment to the Internet, giving them publicly-reachable URLs. You will use a dev tunnel while developing your agent so that the Teams platform can communicate with it while it is running in your developer environment. See [here](/azure/developer/dev-tunnels/get-started) for installation instructions.
21+
22+
## Install the Teams Developer CLI and log in
23+
24+
First, install the Teams Developer CLI, which will be used in the next steps to create scaffolding for a new Teams app and register it with the Teams platform. Run the following commands in a command prompt:
25+
26+
```bash
27+
npm install -g @microsoft/teams.cli@preview
28+
teams login
29+
```
30+
31+
`teams status` should show `Sideloading: enabled`. If it shows `disabled`, your tenant admin needs to enable [custom app upload](/microsoftteams/teams-custom-app-policies-and-settings) before you can install your bot.
32+
33+
## Create project scaffolding
34+
35+
The `project new` command of the Teams Developer CLI creates the source code scaffolding for a new Teams agent application. The CLI includes templates for different kinds of starter functionality that span the SDK's three supported languages: TypeScript, Python and C#.
36+
37+
Run the `teams new` command as shown below for the language of your choice to create the scaffolding for a new application. By not providing a template name, the CLI will scaffold a project using the default `echo` template, which responds to user messages by echoing them back:
38+
39+
# [TypeScript](#tab/typescript)
40+
41+
```bash
42+
teams project new typescript echo-bot
43+
cd echo-bot
44+
```
45+
46+
# [C#](#tab/csharp)
47+
48+
```bash
49+
teams project new csharp echo-bot
50+
cd Echo.Bot/Echo.Bot
51+
```
52+
53+
The C# scaffold creates a solution at `Echo.Bot/` with the project nested inside. Follow the **Next steps** line printed by the CLI for the exact path.
54+
55+
# [Python](#tab/python)
56+
57+
```bash
58+
teams project new python echo-bot
59+
cd echo-bot
60+
```
61+
62+
---
63+
64+
## Start a DevTunnel and register the app with Teams
65+
66+
Installing and using your app in Teams requires that it be reachable from the Internet, registered with the Teams platform, and deployed via its manifest. Achieving these milestones now will help you develop your app by enabling you to experience it in Teams the same way that users will, from the beginning to the end of the development process.
67+
68+
Here, you use the `app create` command of the Teams Developer CLI to both register your application and deploy its manifest. Registration requires a publicly reachable URL for your app, which you will need during development anyway, so you will use `devtunnel` to create that first.
69+
70+
1. Follow the instructions [here](https://learn.microsoft.com/en-us/azure/developer/dev-tunnels/get-started#login) to log in to `devtunnel` and create a new tunnel. Make note of resulting tunnel URL and port.
71+
1. Run the `app create` command as shown below for your language to register your app and deploy its manifest:
72+
73+
# [TypeScript](#tab/typescript)
74+
75+
```bash
76+
teams app create \
77+
--name echo-bot \
78+
--endpoint https://<tunnel-host>/api/messages \
79+
--env .env
80+
```
81+
82+
# [C#](#tab/csharp)
83+
84+
```bash
85+
teams app create \
86+
--name echo-bot \
87+
--endpoint https://<tunnel-host>/api/messages \
88+
--env appsettings.json
89+
```
90+
91+
Credentials are written under a `Teams` section with PascalCase keys (`ClientId`, `ClientSecret`, `TenantId`).
92+
93+
# [Python](#tab/python)
94+
95+
```bash
96+
teams app create \
97+
--name echo-bot \
98+
--endpoint https://<tunnel-host>/api/messages \
99+
--env .env
100+
```
101+
102+
---
103+
104+
The command prints a summary including the **Teams App ID** and an **Install in Teams** link, and writes credentials into your env file.
105+
106+
## Run your agent locally
107+
108+
Run the following commands to start your agent locally:
109+
110+
# [TypeScript](#tab/typescript)
111+
112+
```bash
113+
npm install
114+
npm run dev
115+
```
116+
117+
# [C#](#tab/csharp)
118+
119+
```bash
120+
dotnet run
121+
```
122+
123+
# [Python](#tab/python)
124+
125+
```bash
126+
pip install -e .
127+
python src/main.py
128+
```
129+
130+
---
131+
132+
You should see `listening on port 3978 🚀` in the terminal. Your tunnel will now forward Teams traffic to your local server.
133+
134+
## Install your app in Teams
135+
136+
The **Install in Teams** link from step 4 is your sideload URL. Click it from a browser signed in to Teams, then **Add**.
137+
138+
If you closed the terminal and need the link again:
139+
140+
```bash
141+
teams app get <teamsAppId> --install-link
142+
```
143+
144+
Use the `Teams App ID` printed in step 4. (Run `teams app list` to see all your apps with IDs.)
145+
146+
Send your bot a message to confirm it's working.
147+
148+
::: zone-end
149+
150+
::: zone pivot="agents-toolkit"
151+
13152
## Tools you'll need
14153

15154
To build an agent in Microsoft Teams, ensure you have the following:
@@ -111,6 +250,8 @@ Microsoft 365 Agents Toolkit creates and scaffolds the agent project workspace.
111250
112251
Congratulations! You've created and ran your first agent in Microsoft Teams.
113252

253+
::: zone-end
254+
114255
## Code sample
115256

116257
| Sample name | Description | .NET | Node.js | Python |

msteams-platform/zone-pivot-groups.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,11 @@ groups:
106106
title: TypeScript
107107
- id: python
108108
title: Python
109+
- id: developer-tooling
110+
title: Developer tooling
111+
prompt: Choose the developer tooling you want to use
112+
pivots:
113+
- id: teams-developer-cli
114+
title: Teams Developer CLI
115+
- id: agents-toolkit
116+
title: Microsoft 365 Agents Toolkit

0 commit comments

Comments
 (0)