Pular para o conteúdo

Crie seus próprios dots open source com Pi e Telegram

Ver no idioma original →

Autoria: Hugging Face · Assistir no YouTube

Vídeo de autoria do canal indicado, não da IANIA; todos os direitos pertencem ao criador. Transcrição, resumo e tradução gerados automaticamente; o conteúdo no idioma original é preservado na versão em idioma original.

Idioma original: inglês

Vídeo original: Build Your Own Open-Source Dots with Pi and Telegram · Canal: Hugging Face · 20:38 · Assistir no YouTube

Tópicos: Agentes de IA, Automação de tarefas e workflows, Modelos locais e open source

O vídeo mostra como criar agentes sempre ativos com modelos open source e hospedá-los em uma máquina que permaneça ligada, como uma VPS ou um computador doméstico. Cada agente é configurado em seu próprio diretório, com contexto, ferramentas e skills específicos. Em seguida, o apresentador demonstra como conectar os agentes ao Telegram usando o Pi Gateway, que mantém sessões em um banco SQLite local. Por fim, ele sugere ampliar o projeto com automações, ferramentas e suporte a outras plataformas.

  • Agentes especializados podem funcionar continuamente em uma VPS, computador doméstico ou outra máquina sempre ligada.
  • Cada agente é organizado em um diretório próprio, com um arquivo de contexto, ferramentas e skills específicas.
  • O Google Workspace CLI permite que o agente pessoal interaja com e-mails, calendário e Google Drive.
  • O Pi Gateway conecta agentes a plataformas de mensagens e encaminha conversas para sessões específicas.
  • O gateway usa um banco SQLite local para registrar e retomar sessões.
  • O exemplo demonstra a conexão de bots do Telegram com agentes Pi.
  • É possível configurar vários agentes, cada um com seu próprio diretório e modelo.
  • O apresentador sugere adicionar automações e integrações com outras plataformas, como WhatsApp.
Início Capítulo Resumo
00:00 Visão geral dos agentes sempre ativos O apresentador introduz os dots e mostra exemplos de agentes especializados hospedados em uma máquina sempre ligada.
02:03 Configuração dos agentes e de suas skills Cada agente é organizado em um diretório próprio, e o exemplo de assistente pessoal recebe contexto e acesso ao Google Workspace.
07:15 Como funciona o message gateway O vídeo explica como o gateway recebe mensagens, identifica agentes e sessões e registra essas informações localmente.
11:23 Instalação e configuração do Pi Gateway O apresentador instala o gateway e configura um bot do Telegram, definindo o acesso, o diretório e o modelo.
15:30 Teste dos bots no Telegram O primeiro bot é testado como assistente pessoal, e o vídeo mostra a criação e inicialização de um agente de pesquisa.
19:06 Próximas melhorias e integrações O apresentador resume a configuração e sugere adicionar ferramentas, automações e suporte a outras plataformas.

Vou mostrar como fazer a mesma coisa com modelos open source e hospedá-la na sua própria máquina sempre ligada. — 00:31

Cada agente é basicamente seu próprio diretório, com ferramentas, skills e um arquivo agents.md específicos. — 06:44

A boa notícia é que você não precisa programar o gateway por conta própria. — 10:53

Você pode explorar o repositório e tentar adicionar as plataformas que quiser. — 20:07

  • Dots (conceito): Nome usado no vídeo para agentes sempre ativos e especializados em tarefas específicas.
  • Pi (ferramenta): Harness de terminal usado para executar agentes em diretórios com contexto, ferramentas e skills próprios.
  • Pi Gateway (ferramenta): Gateway apresentado no vídeo para conectar agentes Pi a serviços de mensagens, começando pelo Telegram.
  • Telegram (ferramenta): Plataforma usada na demonstração para enviar mensagens aos agentes por meio de bots.
  • Google Workspace CLI (ferramenta): CLI que fornece ao agente acesso a recursos do Google Workspace, como Gmail, calendário e Drive.
  • SQLite (ferramenta): Banco de dados local usado pelo gateway para armazenar as sessões dos agentes.
  • Firecrawl (ferramenta): Ferramenta citada para adicionar recursos de pesquisa e navegação na web ao agente de pesquisa.
  • OpenAI (empresa): Empresa mencionada como responsável pelo lançamento dos dots que inspiram a demonstração.
  • OpenRouter (empresa): Serviço citado como origem do modelo configurado para um dos bots.
  • Kimi K3 (modelo): Modelo escolhido na demonstração para o agente de pesquisa.
  • VPS (conceito): Servidor virtual apresentado como uma opção de máquina sempre ligada para hospedar os agentes.

00:00 Bom dia, pessoal. Como vão hoje? Recentemente, a OpenAI lançou os dots, que são agents sempre ativos e muito especializados em seus casos de uso específicos. Por exemplo, você pode ter um dot como assistente de pesquisa e outro como assistente pessoal, com acesso ao seu e-mail e à sua agenda, por exemplo. Eles podem realizar tarefas para você e avisar quando encontrarem algo importante, etc. O que vou fazer hoje é mostrar como

00:31 criar a mesma coisa, mas com modelos open source, e como hospedar tudo na sua própria máquina sempre ativa. Vou mostrar como fazer isso na minha VPS aqui, mas o processo é exatamente o mesmo em uma VPS, em um computador desktop que você tenha em casa ou em uma placa DGX, por exemplo, caso queira executar esses modelos localmente, certo? E é tudo muito, muito simples. A arquitetura é um pouco inspirada no que o Hermes e o OpenClaw fazem com o

01:01 gateway de mensagens. Vou explicar um pouco melhor isso daqui a pouco. Mas, como podem ver, é assim que tudo vai ficar no final. No meu caso, criei dois agents diferentes. O Bon Andre aqui é meu agent de pesquisa, e tem ferramentas específicas para pesquisa, além de um system prompt que informa que ele é um assistente de pesquisa. E aqui tenho a Bonnie, que é executada pelo modelo Stealth, o Space Bonnie. Como podem ver, esta tem acesso à minha conta do Gmail e à minha agenda, e

01:32 pode criar e enviar novos e-mails, ler meus e-mails, resumir minha caixa de entrada, criar novos eventos na minha agenda, etc. Você pode criar quantos quiser, dar a eles as ferramentas específicas que desejar e executá-los com suas próprias chaves, usando qualquer modelo que quiser. Vou mostrar como fazer tudo isso aqui. Então, sem mais delongas, vamos começar. Certo. Primeiro, vou mostrar os agents que vamos demonstrar aqui, certo? E é tudo muito, muito

02:03 simples. Como podem ver, estou dentro de um diretório chamado agents e, na verdade, estou na minha VPS. Agora, lembrem-se: a ideia é que esta seja uma máquina sempre ativa. No meu caso, neste exemplo, é uma VPS, mas pode ser o computador desktop da sua casa, se você o deixar ligado, por exemplo. Também pode ser uma DGX Spark, se você tiver uma em casa ou quiser executar modelos locais nela. Isso também pode ser muito legal. Neste caso, é apenas uma VPS, mas qualquer máquina sempre ativa vai permitir recriar isso.

02:33 Porque queremos que nossos agents estejam acessíveis a qualquer momento, não só quando estamos na frente do computador. E aqui, como podem ver, estou no diretório home e tenho um diretório agents. Dentro dele, tenho alguns agents. Meus agents são basicamente apenas diretórios, certo? É muito, muito simples. Se eu abrir um deles, por exemplo, vou abrir o assistente PA, certo? Vou abri-lo e dar uma olhada no que há aqui dentro. Tenho um arquivo

03:05 agents.md. Então, vamos dar uma olhada nele. Na verdade, vou abrir o Tau neste caso. É o harness que estou desenvolvendo aqui. Sim. Ainda não vou enviá-lo. Mas, como podem ver, tenho um arquivo agents.md, que contém o contexto desta pasta específica. Vou clicar nele para dar uma olhada e, como podem ver, ele dá contexto ao meu agent sobre o que está fazendo. Então, você é um assistente pessoal; ajuda o usuário a organizar o trabalho com o Google Workspace por meio da CLI do G— do Google

03:37 Workspace, para que possa acessar meu Gmail, minha agenda, etc. Criar novos eventos na agenda, enviar e-mails, resumir meus e-mails, fazer a triagem deles, etc., certo? Isso já é muito, muito legal. Vou fechar isso aqui. Também tenho várias skills que vão ser bem úteis. Tenho skills de pesquisa, que incluem firecrawl powers, firecrawl scrape e firecrawl search, para que meu assistente pessoal também possa pesquisar na internet. E tem algo que, na verdade, eu ainda não fiz aqui: adicionar as skills. Então,

04:09 deixe-me adicioná-las. Vou executar npx skills add e adicionar as skills da CLI do Google Workspace. Para isso, você vai precisar instalar a CLI do Google Workspace. Isso provavelmente merece outro tutorial, claro, mas aqui vocês podem ver várias skills disponíveis. Quero que ela consiga acessar minha agenda. Também quero que consiga dar uma olhada no meu Google Drive e

04:40 enviar arquivos para o Google Drive. Também quero que consiga consultar todos os meus e-mails e usá-los. Digamos que é só isso. Vou apertar Enter. Quero garantir que isso fique disponível para o Pi e vou definir que a instalação será apenas para este projeto, pois ficará instalada somente para este agent específico. Vou dizer que sim, para instalar usando o link simbólico. Prosseguir com a instalação. E pronto. Agora, se eu abrir meu assistente de novo, vocês vão ver

05:10 que agora tenho várias skills aqui, incluindo as do Google Workspace. Mais uma vez, se quiserem usar este harness aqui, ele é o Tau. É o que uso para programar na maior parte do tempo. É literalmente uma versão do Pi em Python. E, claro, também podem ver isso no Pi. Deixe-me confiar nesta pasta. E, como podem ver aqui, estão todas as skills que mencionei antes. E pronto. Este aqui é o que está no meu agent de pesquisa.

05:40 Desculpem, no meu agent PA, para o qual posso pedir coisas como: “Quais são os e-mails não lidos mais recentes na minha caixa de entrada?” Posso enviar isso aqui e ele vai me responder. Nossa, provavelmente não devia ter usado o Astra para uma pergunta tão simples, mas pronto. Ele consegue ler meus e-mails e, claro, não quero ter que me conectar ao Pi pelo Herder toda vez que quiser fazer isso.

06:11 Por isso, vamos conectá-lo ao Telegram daqui a pouco. Mas, como podem ver, funciona: ele sabe sobre meus e-mails e pode me ajudar a organizar minhas coisas. E este é só um agent, certo? Se eu voltar, tenho outros agents aqui. Deixe-me limpar isto. Tenho outros agents aqui. Tenho meu pesquisador e, para este, posso adicionar skills diferentes, coisas diferentes, um arquivo agents.md diferente para dar a ele uma personalidade diferente, etc. Certo? Pronto. É basicamente isso que são meus agents. Cada agent é, essencialmente, seu próprio diretório,

06:44 com suas ferramentas específicas, suas skills específicas e seu arquivo agents.md específico. Você pode simplesmente organizá-los todos juntos assim, certo? Agora que fez isso, eu recomendaria pensar nos diferentes agents que quer criar, nas diferentes ferramentas que quer dar a eles e nas diferentes skills. Depois que isso estiver pronto, podemos conectá-los ao nosso gateway. Então, vamos ver o que é esse gateway. Certo, vou mostrar como vamos

07:15 montar o gateway, que vai nos permitir conectar ao nosso assistente sempre ativo não só usando o Herder ou SSH, mas também usando várias plataformas diferentes, como Telegram, WhatsApp, e-mail, Slack, etc. Certo? E, para dar um pouco de contexto sobre isso, foi justamente isso que tornou agents como o Hermes ou o OpenClaw tão importantes e populares, certo? A ideia por trás do Hermes

07:47 e o OpenClaw. E o que realmente fez a ficha cair para a maioria das pessoas não é só o fato de eles terem muitas integrações com várias ferramentas diferentes, mas também o fato de serem uma espécie de assistente pessoal com quem você pode conversar em qualquer plataforma que normalmente usaria para falar com seus assistentes humanos de verdade, certo? Por exemplo, você pode falar com o Hermes e o OpenClaw pelo Telegram, pelo chat, pelo WhatsApp, por e-mail etc. E o que vamos fazer com

08:19 nosso sistema de comunicação, ou com nossos dots open source, é construir um sistema parecido, certo? Os dois têm algo chamado gateway de mensagens, que é um processo em segundo plano na máquina que fica sempre ligada, seja uma VPS, um DGX Spark ou algo do tipo. Essa máquina que fica sempre ligada vai ter esse processo em segundo plano, que estará constantemente escutando as várias plataformas com as quais tiver integração.

08:49 E o exemplo que vou mostrar aqui só oferece suporte ao Telegram por enquanto, mas isso pode ser um projeto muito legal para você. Vou mostrar mais adiante como implementar a mesma coisa com outras plataformas. O que vai acontecer é que esse processo aqui vai continuar escutando nossas mensagens do Telegram. Quando o Telegram enviar uma mensagem para o nosso gateway, ele vai criar um ID. Esse ID vai conter alguns elementos.

09:21 Ele vai incluir a origem, que será o Telegram, certo? Vai incluir o nome do agent, por exemplo, meu agent do Pi. E também vai incluir o ID da minha sessão do Pi, certo? Assim, essa mensagem será armazenada no meu SQLite. Se não houver uma sessão no meu SQLite associada a ela, será criada

09:51 uma nova sessão no meu banco de dados SQLite. A propósito, o banco de dados SQLite é executado localmente na minha máquina que fica sempre ligada, ou seja, na minha VPS, neste caso. E será criada uma nova sessão. Depois, sempre que receber uma nova mensagem do Telegram, ele vai verificar se ela vem do meu agent do Pi. Vai verificar se é a mesma sessão e, então, vai enviar a mensagem e encaminhá-la para essa sessão naquele diretório específico, certo? E lembre-se de que o Pi funciona em cada diretório. Assim, como a mensagem será enviada para a sessão específica do Pi naquele diretório específico,

10:23 ela vai usar nossas skills, nossas ferramentas e o contexto que definimos no capítulo anterior, certo? E é basicamente isso que vai acontecer. Se, em algum momento, eu enviar /new pelo Telegram para criar uma nova sessão, a mensagem vai chegar aqui, o processo vai começar e identificar que essa sessão ainda não está no meu banco de dados SQLite. Então, vai criar uma nova entrada para uma sessão diferente, e assim vamos

10:53 continuar a conversa nas minhas sessões do Pi, certo? É basicamente isso que está acontecendo aqui. É muito legal e bem simples, e a boa notícia é que você não precisa programar o gateway por conta própria. Na verdade, preparei uma coisinha bem legal para você. É bem simples. Comecei a usar isso há alguns meses, quando o Termux foi lançado. Comecei a usar quando o Termux estava no auge da popularidade, porque eu queria algo bem minimalista. E eu

11:23 comecei a usar, e ele é basicamente um gateway bem minimalista que você pode executar na sua VPS. Vou mostrar daqui a pouco como executá-lo. Ele roda em segundo plano e permite criar vários bots aqui. Como você pode ver, é muito, muito leve. Foram uns 34 commits até chegar ao estado atual. E agora vou mostrar como usá-lo. Vamos direto para a nossa VPS de novo para configurar tudo. Ainda precisamos

11:53 ter acesso à nossa máquina via SSH. Então, aqui, deixa eu mostrar. Pronto, tenho acesso. Primeiro, vou instalar com o comando uv tool install pi-gateway. Isso vai instalar a ferramenta que acabei de mostrar. E, só para confirmar que ela existe, vamos dar uma olhada. Aí está. O Pi Gateway está instalado. Agora vou

12:24 entrar no meu assistente do agent do Pi, aqui. Pronto. Aqui está meu agent do Pi, como mostrei antes. Vou executar pi-gateway e inicializá-lo aqui. Então, pi-gateway init. Certo. Vamos abrir o Telegram, e vou deixar na descrição o ID exato do bot que você precisa procurar para criar seu próprio bot. Ele se chama BotFather, assim,

12:55 certo? Depois de encontrá-lo, confira se ele aparece assim e se o ID é o mesmo que você está vendo aqui. Vamos enviar /newbot, certo? Porque este vai ser um bot do Telegram. Pronto. Vamos criar um novo bot. Que nome vamos dar a ele? Vou chamá-lo de Bunny, porque vou usar um modelo stealth chamado Space Bunny. Em seguida, ele diz: “Agora vamos escolher um nome de usuário para o meu bot.”

13:26 Também vou usar Bunny como nome de usuário. Vou acrescentar vários caracteres estranhos, porque ele precisa ser único. Pronto. Opa, não pode terminar em “test”. Tem que terminar em “bot”, assim. Pronto. Agora ele me enviou isto aqui, que é o token para usar esse bot. Vou copiar e colar aqui.

13:56 E aqui, outra coisa muito importante caso você esteja criando seu próprio gateway para o Telegram: você precisa bloquear o acesso de IDs que não estão autorizados. Neste caso, para descobrir meu ID de usuário, vou procurar o bot de informações do usuário. Procure por ele usando exatamente este ID. Depois, envie /start. Ele vai mandar seu ID. No meu caso, meu ID está aqui. Então, posso simplesmente colá-lo. Pronto. Agora ele

14:27 vai me perguntar em qual diretório quero iniciar esta sessão do Pi, para que este bot do Pi comece a funcionar. É claro que quero que seja dentro do diretório do meu assistente do Pi, porque quero que ele tenha todo o contexto que mencionamos antes. Então, vou pressionar Enter. Depois, ele pergunta qual modelo quero usar. No meu caso, como eu disse antes, vou usar o Space Bunny, da OpenRouter. Pronto. Acho que o nível vai ser o mesmo. E este

14:58 também me pediu para dar um nome a ele. Vou chamá-lo de Bunny. Pronto. Agora posso executar pi-gateway start -i para dar um nome à instância e dizer Bunny. Pronto. Agora o Pi Gateway está… Ah, desculpe. Não é stop, é start. Pronto, o Pi Gateway foi iniciado. Também posso consultar o status do Pi Gateway. Como você pode ver, meu Pi Gateway está funcionando. Também posso ver quais

15:30 Os bots estão sendo executados dessa forma, e posso dizer «instâncias». Como você pode ver, estou executando o Bunny aqui. O que posso fazer agora é ir até aqui, voltar ao meu bot e clicar neste Bunny. Clique e inicie. Pronto. Meu assistente Pi está iniciado. Então, vamos conversar um pouco com ele. Vamos perguntar: quem é você?

16:00 E o que você é capaz de fazer? Como você pode ver, está funcionando um pouco. E pronto: seu assistente pessoal, executado localmente em um harness de terminal, que é o Pi. Ele tem acesso ao meu Google Workspace, ao meu Gmail, ao meu calendário, ao meu drive, aos meus contatos etc. E pronto. Agora posso simplesmente mandar mensagens para ele todos os dias. Recomendo que você clone o repositório Pi Gateway que mostrei

16:31 aqui. Explore um pouco e tente desenvolver algo em cima dele. Algo que eu gostaria de adicionar no futuro, por exemplo, são automações. Se isso for executado automaticamente todos os dias, posso, por exemplo, agendar automações para todos os dias de manhã: verificar meu e-mail, resumir e fazer a triagem para mim, além de organizar tudo para que eu possa arquivar as coisas com mais facilidade pela manhã, certo? Esse tipo de coisa. O mesmo vale para o agente de pesquisa. Então, vamos começar a configurar o agente de pesquisa. Vou voltar e acessar o

17:01 agente de pesquisa. Deixe-me ir até aqui. Vou acessar o Pi Gateway e inicializar outro agente. Para este segundo, vou inicializar um novo bot aqui. Este será um bot novo, um agente de pesquisa. Vou chamá-lo de Andre. Pronto. Agora preciso adicionar um ID para ele. Vou chamá-lo de Andre. Vou adicionar várias

17:33 coisas diferentes, porque o nome de usuário precisa ser único. Pronto. Vou copiar isto novamente. Meu usuário do Telegram, para que só eu possa entrar em contato com ele dessa forma. Isso precisa ficar dentro de «researcher». E que modelo vou usar para este? Para este em particular, vamos usar… Sim, vamos usar este. Quero usar o Kimi K3. Certo, vamos escolher o Kimi K3 aqui. Nível de raciocínio padrão, e este vai se chamar

18:05 Andre. Pronto. Agora, se eu executar o Pi Gateway e conferir minhas instâncias, você pode ver que tenho o Bunny e o Andre funcionando. E, quanto ao Andre, se olharmos aqui, vou abrir o bot Andre. Posso perguntar: «Olá. Quem é você e o que é capaz de fazer?»

18:35 Ah, foi mal. Esqueci de iniciá-lo. Vou executar o Pi Gateway start e iniciar o Andre assim. Agora o agent está em execução e posso conferir. Diz que o Pi Gateway se conectou. Vou enviar minha mensagem de novo. Pronto. O Pi está funcionando, e este aqui é meu agente de pesquisa. Ele tem o FireKrawl. Posso adicionar outros plugins e ferramentas depois. Então,

19:06 pronto. É muito simples. É uma maneira bem fácil de ter vários agents aqui, todos especializados no seu telefone para você continuar de onde parou enquanto está em movimento, e cada um é especializado em uma tarefa. Cada um deles, assim como os da OpenAI, tem seu próprio computador, porque, na verdade, tem seu próprio espaço de trabalho aqui. Como você pode ver, este é simplesmente um espaço de trabalho para ele, onde pode criar e escrever arquivos,

19:37 fazer pesquisas etc. Então, é muito útil. Pronto, espero que isso tenha sido útil. Este é um tutorial bem curto e uma demonstração rápida de como você pode criar isso por conta própria. Conte para mim se quiser uma explicação mais detalhada de como o Pi Gateway funciona. Por exemplo, se quiser dar uma olhada na arquitetura propriamente dita e em como criá-la, ou se quiser expandi-la um pouco. Algumas tarefas que eu deixaria para você seriam, por exemplo,

20:07 adicionar mais ferramentas aos seus agents e adicioná-las ao seu agent Pi por meio de MCP ou de ferramentas personalizadas. Você também pode explorar um pouco o repositório que tenho aqui e tentar adicionar as plataformas que quiser. Por exemplo, você pode adicionar suporte ao WhatsApp. Mas, nesse caso, teria que descobrir como conectar o WhatsApp ao gateway. Você sempre pode se inspirar em repositórios open source que já fazem isso, como o OpenClaw ou o Hermes, por exemplo.

20:38 Então, é isso. Espero que tenha sido útil para você. Muito obrigado por assistir e conte para mim o que gostaria de ver a seguir. Tenha um ótimo dia e até o próximo vídeo.

Transcrição original

[00:00] Good morning, everyone. How’s it going today? So, recently OpenAI released dots, which are always-on agents that are very specialized in their specific use case. So, for example, if you can have a dot to be a research assistant, another dot to be a personal assistant with access to your email and your calendar, for example, and they can perform tasks for you, and they can ping you whenever they find something important, etc. Uh what I’m going to do today is I’m going to show you how to

[00:31] build the same thing, but with open-source models, and how you can host it your own in your own always-on machine. Uh I’m going to be showing how to do this in my VPS right here, but the process is exactly the same in a VPS, in a desktop that you may have at home, or a DGX board, for example, that you might have at home if you want to run these models locally, okay? And it is very, very straightforward. The architecture is a little bit inspired by what uh Hermes and Open Claude do with the

[01:01] message gateway. I’m going to be explaining a little bit more of that in a moment. But as you can see, this is what you’re going to have by the end. In my case, I created two different agents. Bon Andre right here is my research agent, and it has specific tools for research, and it has a system prompt that tells it that it is a research assistant. And right here, I have Bonnie, which is powered by the Stealth model, um Space Bonnie. And as you can see right here, this one has access to my Gmail account, to my calendar, and it

[01:32] can create new emails, send them, read my emails, summarize my inbox, create new events in my calendar, etc. And you can create as many as you want, give them their specific tools that you want, run them on your own keys, with any model that you want, and I’m going to show you how to do all of that right here. So, without any further ado, let’s get right into it. All right. So, first of all, let me show you the agents that we’re going to demo right here, okay? And it is very, very

[02:03] straightforward. As you can see, I am inside an agents directory, and I am actually inside of my VPS right here. Now, again, this is supposed to be an always-on machine, so my case it’s a VPS in this example, but this can be your home desktop if you leave it on, for example. It can be a DGX Spark if you have it at home or you want to run local models out of it. That can be also very cool. Uh in this case, it’s just a VPS, and but any always-on machine will be able to uh recreate this.

[02:33] Um because we want our agents to be reachable anytime, not only when we’re in front of our computer. And right here, as you can see, I am in the home directory, and I have an agents directory right here, and inside of it I have a couple of agents. And my agents are essentially just directories, okay? It’s very, very straightforward. And if I open one of them, for example, I’m going to open the PA assistant, right? And I’m going to open it, and let’s take a look at what is inside here. I have an

[03:05] agents.md file, so let’s take a look at it. Actually, I’m going to open Tau in this case. It’s the um the harness that I’m building right here. Um yep, yeah. I’ll not won’t upload immediately. But as you can see right here, I have an agents.md file, which is the context from this specific folder. So, I’m going to click on it to take a look at it, and as you can see, it gives my agent context about what he’s doing. So, uh you’re a personal assistant, you help the user organize their work with Google Workspace through the G um Google

[03:37] Workspace CLI, uh so that it can have access to my Gmail, to my calendar, etc. Create new calendar events, send email, summarize my email, triage them, etc., right? So, that’s already very, very cool. I’m going to close this right here, and I have a bunch of skills as well that are going to be quite useful. I have research skills, which is the firecrawl powers, firecrawl scrape, and firecrawl search, so that my PA assistant can also search the internet. And something that I didn’t do right here actually uh is add the skills. So,

[04:09] let me just add them. So, I’m going to just do NPX skills add and I’m going to add the skills from the Google Workspace CLI. And in order to have this, you’re going to have to install the Google Workspace CLI. Uh so, that I mean, of course, that’s probably another tutorial, but here you can see the bunch of skills that they have available. So, I’m going to want it to be able to access my calendar, my agenda. I want it to be able to also take a look at my Google Drive and to

[04:40] upload files to Google Drive. I want it to be take a look at all my emails as well and be able to use that. And let’s say that that is all. Going to hit enter. I want to make sure that this is available for Pi, and I’m going to set that this is going to be installed only for this project because it’s going to be installed only for this specific agent. Going to say yes, install it with the sim link. Uh proceed with installation, and there we go. Now, if I open my assistant again, you will see

[05:10] that here I have a bunch of skills right now, and they include the Google Workspace. Again, if you want to use this harness right here, it is Tau. It is one the one that I use for coding most of the time. It’s literally just a port of Pi in Python. And you can also, of course, look at this in Pi. Uh let me just trust this folder. And as you can see right here, we have all my skills that I told you before. And uh there you go. Now, this one right here is all right in my research agent.

[05:40] I’m sorry, my PA agent that I can ask it like things like, “What are the recent uh unread emails that I have in my inbox. I can send that right here and it will answer for me. Oof, probably shouldn’t have used Astra for this simple question, but there you go. And there you go. It can read my emails and of course I do not want to be into need to connect to Pi via Herder every single time that I want to do this.

[06:11] That’s why we’re going to be connecting this to Telegram in a moment. But as you can see it works, it knows about my email, it help it can help me organize my stuff and this is just one agent, right? If I go back up I have other agents right here. Let me just clear this. I have other agents right here. I have my researcher and for this one I can add different skills, different stuff, different agents.md file to give it a different personality, etc. Okay? So, there you go. That is essentially what my agents are. Each agent is essentially its own directory

[06:44] with its specific tools, specific skills, and specific agents.md file and you can just put them all together like this, okay? Now, that now that you have done that, how I would encourage you to to imagine the different agents that you want to create, the different tools that you want to give them, and the different skills. Once that is done, we are ready to actually connect it to our gateway and let’s take a look at what the gateway actually is now. Okay, so let me show you how we’re going

[07:15] to be building the gateway that is going to allow us to connect to our always-on assistant not only using Herder or SSH, but using a multiple multiple different platforms such as Telegram, WhatsApp, email, Slack, etc. Okay? And just to give you a little bit of precedent and a little bit of context about this, this is actually what made the agents such as Hermes or Open Cloze so important and so popular, right? The idea behind Hermes

[07:47] and Open Cloze and the thing that really clicked with most people is not only that they have a lot of integrations with a lot of different tools, uh but the fact that they are sort of your personal assistant that you can talk to from any platform that you would usually use to talk to your actual human assistants, okay? So, for example, you can talk to Hermes and Open Cloze via Telegram, via chat, via via WhatsApp, email, etc. And what we’re going to be doing with

[08:19] our commas or with our dots open source dots is we’re going to be building a similar system, okay? So, uh both of these have something that is called a message gateway, which is a background process in the always-on machine, be it a VPS, a spar DGX spark, etc. And this always-on machine’s going to have this uh background process that is going to be constantly listening to whichever integration it has with multiple

[08:49] platforms. And the example that I’m going to be doing right here, it only supports uh Telegram right now, but that can be a really actually cool project for you. I’m going to show you how you can uh um implement the same thing but with other different uh platforms later on. Um so, what’s going to happen is that this process right here is going to keep listening to our Telegram messages. Uh when Telegram sends a message to our gateway, this gateway is going to create an ID. And that ID is going to uh have a

[09:21] uh few uh elements. It’s going to include the source, so it’s going to the source is going to be Telegram, okay? Uh it’s going to include the name of the agent, so it’s going to be, for example, my PI agent. And it is going to be include the ID of my session from Pi, okay? And that way, that message is going to be stored in my SQLite, okay? So, if there is no session in my SQLite associated to that, it’s going to create

[09:51] a new session in my SQLite database. By the way, the SQLite database runs locally in my always on machine, so in my VPS in this case. And it is going to create a new session. Then, whenever it receives a new message from Telegram, it’s going to see that it comes from my PA agent. It’s going to see that it’s the same session, so it’s going to send that and route it to that session in that particular directory, okay? And remember that Pi works in each directory, so that way uh since it will be sending that message to the specific

[10:23] Pi session in that specific directory, it’s going to run with our skills, with our tools, with our context that we defined in uh the last chapter, okay? And that’s essentially all that is going to be happening. And if at some point I do {slash} new on Telegram to create a new session, then it’s going to get right here, it’s going to start and it’s going to identify that uh it’s that’s a session that is not yet in my SQLite database, so it’s going to create a new entry for a different session, and that way we’re going to

[10:53] continue the conversation in my sessions in Pi, okay? That’s essentially all that is going on right here. It’s very fun, very straightforward, and the good news is that you do not need to code the gateway yourself. I actually have prepared this nice little thing for you. Uh it’s very straightforward. I started it using it a few months ago when um Termux came out. I when Termux was in its peak uh popularity, because I wanted something very minimalist. And uh I

[11:23] started using it, and it’s basically just a very minimalist gateway that you can run in your VPS. I’m going to show you in just a moment how to run it. And it runs in the background and it you you can create a bunch of different bots right here. And as you can see it’s very very lightweight. It took me like 34 commits to finish this up until the current state. And yeah, uh let me show you how to actually use it. So, uh what we’re going to do is we’re going to go straight to our VPS again in order to set this up. We still have to

[11:53] have access to our uh machine via SSH. So, right here, let me just show you. And right here, I have access. And what I’m going to do first of all is I’m going to install so UV tool install uh Pi Gateway, okay? And this is going to install this uh this tool that I just showed you. And just to be sure that it’s it exists, we’re just going to take a look at it. There we go. Pi Gateway is installed. And what I’m going to do now is I’m

[12:24] going to go into my PI agent uh assistant right here. And there we go. So, here is my PI agent as I showed you before. Uh what I’m going to do is PI uh Pi Gateway and I am going to just initialize it right here. So, Pi Gateway init. All right. So, we’re going to go to Telegram right here and I’m going to show you I’m going to link in the description the exact ID of the bot that you have to call to create your own bot. But uh it’s called Bot Father like this,

[12:55] okay? And once you have found it and it looks like this and you’re sure that it is the same uh ID as you see right here. We’re going to do {slash} new bot, okay? Because this is going to be a Twitter um a Telegram bot. All right. So, there you go. So, we’re going to start a new bot. How are we going to call it? I’m going to call him Bunny. Because I’m going to be using a bunny uh space bunny uh stealth model. Um then it says, “Now let’s choose some username for my bot.” Uh

[13:26] it’s going to be also bunny. I’m just going to add a lot of weird characters because it has to be a unique one. And there we go. Oops. Uh it’s not supposed to end at test. It’s supposed to end in bot like that. And there we go. And uh now it has sent me this thing right here, which is the token to or to use this uh this uh bot. And this is the thing that I’m going to copy and I am going to paste it right here.

[13:56] And here, also very important in case you’re building your own gateway for Telegram, you want to block uh which IDs have access to it. Um So, in this case, my user ID uh in order to look it up, you’re going to go to your user info bot. Just look it up like this with this exact ID. And just ask it uh {slash} start. And it will send you your ID. Okay, in my case, my ID is right here. So, I can just paste it. And there you go. Now, it is

[14:27] going to ask me in which directory do I want this to uh start this um this Pi session this Pi uh bot to start. And of course, I want it to be inside my P A assistant uh directory because I want it to have all the context that we mentioned before. So, I’m just going to hit enter. And after that, it asks me which model I want it I want to use with it. And in my particular case, as I told you before, I’m going to be using uh space bunny from Openrouter. And there we go. I think in level it’s going to be the same one. And this one

[14:58] it also asked me to name it. I’m going to name it bunny. There we go. And now, what I can do is I can do Pi gateway and I can do start and I do {dash} I to name the instance and I say bunny. And there you go. Now, Pi gateway is Oh, sorry. Uh it’s not stop, it’s start. And there we go. Now, it started Pi gateway. I can also take a look at Pi Gateway status. And as you can see, my Pi Gateway is running. I can also take a look at which

[15:30] bots are running by doing this, and I can say instances. And as you can see, I am running Bunny right here. And what I can do right now is I can just go right here, go back to my bot, and let’s click on this Bunny right here. Click and start. And there we go. My Pi assistant right here is started. So, let’s actually just chat a little bit with it. Let’s say, um who are you?

[16:00] And what are you capable of doing? As you can see, it’s working a little bit. And there you go. Your personal assistant running locally in a terminal harness, which is Pi. It has access to my Google Workspace, to my Gmail, to my calendar, to my drive, to my contacts, et cetera. And there you go. I mean, now I can just text it every day. And I would encourage you to clone the Pi Gateway repository that I showed

[16:31] you right here. Explore it a little bit, and try to build on top of it. Something that I would like to add in the future, for example, is automations. So, if this thing runs automatically every day, so I can, for example, schedule automations for every day at in the morning, check my email, summarize it, and triage it for me, and organize it for me, so I can archive things more easily in the morning, right? So, these kinds of things. Same thing for the research one. And then, let’s just start off the start off the research one. So, I’m just going to go back, just going to go to the

[17:01] researcher one, and let me just go right here. I’m just going to go Pi Gateway, and I’m going to initialize another one right here. Uh for this second one, I’m going to initialize a new bot right here. So, this one’s going to be a new bot. It’s going to be a researcher. I’m going to call this one Andre. And there we go. Now, I need to add an ID for it. So, I’m going to call it Andre. I’m just going to add a bunch of

[17:33] different things cuz it has to be unique username. And there we go. Just going to copy this again. My Telegram user, so only I am allowed to contact like this. It has to be inside researcher. And what model am I going to use for this one? For this particular one, let’s use Yeah, let’s post it for this one. I want to use Kimi Kimi K3. Okay, so let’s go with Kimi K3 right here. Thinking level default, and this one is going to be

[18:05] called Andre. And there we go. So, now if I do Pi Gateway and I take a look at my instances, my instances, you can see that I have Bunny and Andre working. And Andre, if we take a look at this, let me just open the Andre bot right here. I can just ask it. Hello. Who are you and what are you capable of doing?

[18:35] Oh. Oh, my bad. I forgot to start it. So, I’m going to do Pi Gateway start and we’re going to start Andre like this. And now I agent is running and I can take a look at it. It says the Pi Gateway got connected. I’m just going to send my message again. And there you go. Pi is working and this one right here is my research agent. It has FireKrawl. It has I can later on add other plugins and other tools. So, there

[19:06] you go. It’s very straightforward. It’s a very easy way to have a bunch of different agents right here. All of them specialized in your phone or to continue on the go and every single one is specialized in the whole thing. Every single one actually, just like the ones from OpenAI, has its own computer because it actually has its own workspace right here. As you can see, this is just it’s just a workspace for it where it can create, write files,

[19:37] perform research, etc. So, it is very very useful. Um so, there you go. I hope that this has been useful. It is a very very short tutorial and very straight very quick demo of how you can build this thing yourself. Please do let me know if you want a more detailed explanation of how the Pi gateway works. For example, if you want to take a look at the actual architecture and how to create it, if you want to maybe expand it a little bit. Some things that I would leave you as homework would be to, for example,

[20:07] add more tools to your agents and add them via CP or via custom tools to your Pi agent, for example, or you can also explore a little bit the repository that I have right here and try to add your own platforms that you want. So, for example, it can be you can add what support for WhatsApp, for example. But in that case, you would have to learn figure out how to to connect WhatsApp to the to the gateway. You can always take inspirations from from open-source repositories that already do that, such

[20:38] as OpenFlow or Hera news, by the way. Um so, yeah, there you go. I hope that this has been useful to you. Thanks a lot for watching and please do let me know what you want to see next. Have a great day and I will see you in the next one.