IA & Agentes
Copilot Studio - Publicando e Governando [3] - O agente no seu site ou canal customizado
Copilot Studio - Publishing & Governing [3] - The agent on your custom website or channel
Fala dataholics! Nos dois primeiros posts da série a gente publicou o agente no Teams e no Microsoft 365 Copilot, os dois grandes territórios da Microsoft. Só que nem todo agente é pra funcionário interno. Às vezes você quer o bot no portal do cliente, na intranet, num site de atendimento, num lugar fora do mundo Microsoft. Hoje a gente vê como jogar o agente pra dentro de um site ou canal customizado, e já aviso que tem uma pegadinha de autenticação que derruba muita gente.

O que veremos nesse post:
O demo website (o teste rápido que já vem pronto)
Custom Website: o embed via iframe no seu site
A pegadinha da autenticação
Quando você precisa de SSO de verdade
O demo website
Toda vez que você publica o agente, o Copilot Studio já monta pra você um demo website, uma página pronta e hospedada pela própria Microsoft só pra testar. Ele serve pra você mandar o link pro time ou pro stakeholder dar uma olhada no agente enquanto você ainda está construindo, sem precisar configurar nada. É o jeito mais rápido de tirar o agente do Test pane e mostrar pra alguém. Não é lugar de produção, é vitrine mesmo, mas quebra um galho enorme na validação.
Custom Website: o embed no seu site
Quando você quer o agente rodando de verdade no seu site, o caminho é a aba Channels e a opção Custom Website. O Copilot Studio te dá um trecho de código iframe já configurado, com o widget de chat pronto, e você cola isso na página onde quiser. Colou, o balãozinho de chat aparece no seu site e as pessoas conversam com o agente ali mesmo, sem instalar nada e sem sair do seu domínio.
Se o seu portal é SharePoint, dá pra ir além do iframe cru e empacotar o agente como um web part (SPFx), que fica mais integrado ao visual do site. Mas pra maioria dos casos, o iframe do Custom Website já resolve.
A pegadinha da autenticação
Aqui está o detalhe que faz todo mundo tropeçar. Aquele código de embed do Custom Website só aparece se o seu agente estiver com a opção "No authentication" nas configurações de segurança. Ou seja, o embed fácil é pra agente público, sem login.
No momento que você liga autenticação (Authenticate with Microsoft ou manual), o código de embed simplesmente some da tela. E se você tenta contornar, esbarra na autenticação manual, aquela do magic code, onde o usuário abre uma aba, copia um código e cola de volta no chat. Funciona, mas é uma experiência horrível e não tem SSO nenhum.
Reginaldo, mas os meus usuários já estão logados no meu site, eu queria que o agente reconhecesse eles sozinho. Não dá?
Pelo embed pronto do Custom Website, não dá. Esse caminho é pensado pra cenário público. Pra ter login de verdade e carregar a identidade do usuário sem esse teatro do magic code, você precisa descer um degrau, que é o próximo tópico.
Quando você precisa de SSO de verdade
Se o caso é um site autenticado e você quer que o usuário já entre reconhecido, o embed pronto não serve e você parte pra uma integração mais na mão. São dois caminhos:
Self-host do Web Chat: em vez do iframe da Microsoft, você hospeda o componente de chat (o Web Chat) no seu próprio front-end e controla a autenticação, passando o token do usuário que já está logado. Dá mais trabalho, mas você fica dono da experiência.
Microsoft 365 Agents SDK: pra quem quer plugar o agente dentro de uma aplicação web ou nativa de forma mais profunda, com o Copilot Studio client. É o caminho pro pessoal de dev que quer controle total.
A régua é simples: agente público no site, usa o iframe do Custom Website e segue a vida. Agente autenticado com SSO, esquece o embed pronto e vai de self-host ou SDK.
RESUMO
Demo website: página pronta e hospedada pela Microsoft, ótima pra testar e mostrar pro time, não é produção.
Custom Website: pega o código iframe em Channels e cola no seu site, o widget de chat aparece na hora.
O embed iframe só aparece com "No authentication". Ligou auth, o código some e sobra a autenticação manual do magic code.
Pra SSO de verdade num site logado: self-host do Web Chat ou o Microsoft 365 Agents SDK.
SharePoint tem o atalho do web part (SPFx) pra deixar mais integrado.
Agora o agente já vai do Teams ao seu site externo, cobrindo dentro e fora da Microsoft. Fechamos a parte de onde publicar, e a partir do próximo post a gente vira a chave pra governança: como enxergar, controlar e proteger todos esses agentes quando eles começam a se multiplicar, começando pelo Microsoft Agent 365. Comenta aí onde você já embedou um agente.
Referências:
https://learn.microsoft.com/en-us/microsoft-copilot-studio/publication-connect-bot-to-web-channels
Fique bem e até a próxima.
#copilotstudio #webchat #embed #ia #agentes #datainaction
Hey dataholics! In the first two posts of the series we published the agent to Teams and to Microsoft 365 Copilot, the two big Microsoft territories. But not every agent is for an internal employee. Sometimes you want the bot on the customer portal, on the intranet, on a support site, somewhere outside the Microsoft world. Today we see how to drop the agent into a custom website or channel, and I'll warn you upfront there's an authentication gotcha that trips a lot of people up.

What we'll cover in this post:
The demo website (the quick test that comes ready)
Custom Website: the iframe embed on your site
The authentication gotcha
When you need real SSO
The demo website
Every time you publish the agent, Copilot Studio already builds you a demo website, a ready page hosted by Microsoft itself just for testing. It's there for you to send the link to the team or the stakeholder so they can take a look at the agent while you're still building, without configuring anything. It's the fastest way to get the agent out of the Test pane and show it to someone. It's not a production spot, it's more of a showcase, but it saves you a ton of trouble during validation.
Custom Website: the embed on your site
When you want the agent actually running on your site, the path is the Channels tab and the Custom Website option. Copilot Studio gives you a chunk of iframe code already configured, with the chat widget ready, and you paste that into whatever page you want. Once pasted, the little chat bubble shows up on your site and people talk to the agent right there, without installing anything and without leaving your domain.
If your portal is SharePoint, you can go beyond the raw iframe and package the agent as a web part (SPFx), which sits more integrated into the site's look. But for most cases, the Custom Website iframe already does the job.
The authentication gotcha
Here's the detail that trips everyone up. That Custom Website embed code only shows up if your agent is set to "No authentication" in the security settings. In other words, the easy embed is for a public agent, no login.
The moment you turn on authentication (Authenticate with Microsoft or manual), the embed code simply disappears from the screen. And if you try to work around it, you run into manual authentication, the magic code one, where the user opens a tab, copies a code and pastes it back into the chat. It works, but it's a horrible experience and there's no SSO whatsoever.
Reginaldo, but my users are already logged into my site, I wanted the agent to recognize them on its own. Can't it?
Through the ready-made Custom Website embed, no. That path is designed for the public scenario. To get real login and carry the user's identity without the magic-code theater, you need to go down a level, which is the next topic.
When you need real SSO
If the case is an authenticated site and you want the user to come in already recognized, the ready embed won't do and you go for a more hands-on integration. There are two paths:
Self-hosting Web Chat: instead of Microsoft's iframe, you host the chat component (Web Chat) on your own front-end and control the authentication, passing the token of the user who's already logged in. It's more work, but you own the experience.
Microsoft 365 Agents SDK: for those who want to plug the agent more deeply into a web or native application, with the Copilot Studio client. It's the path for the dev crowd that wants full control.
The rule of thumb is simple: public agent on the site, use the Custom Website iframe and move on. Authenticated agent with SSO, forget the ready embed and go with self-host or the SDK.
RECAP
Demo website: a ready page hosted by Microsoft, great for testing and showing the team, not production.
Custom Website: grab the iframe code in Channels and paste it into your site, the chat widget shows up right away.
The iframe embed only shows up with "No authentication". Turn auth on and the code disappears, leaving the magic-code manual authentication.
For real SSO on a logged-in site: self-host Web Chat or the Microsoft 365 Agents SDK.
SharePoint has the web part (SPFx) shortcut to make it more integrated.
Now the agent goes from Teams to your external site, covering inside and outside Microsoft. We've wrapped up the where-to-publish part, and from the next post on we flip the switch to governance: how to see, control and protect all these agents when they start multiplying, starting with Microsoft Agent 365. Comment below where you've already embedded an agent.
References:
https://learn.microsoft.com/en-us/microsoft-copilot-studio/publication-connect-bot-to-web-channels
Stay well and see you next time.
#copilotstudio #webchat #embed #ai #agents #datainaction
Gostou? Tem mais no YouTube e no LinkedIn.
Enjoyed it? There's more on YouTube and LinkedIn.