Como aprendi a parar de me preocupar e amar o sandbox
Autoria: AI Engineer (E2B) · 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: How I Learned to Stop Worrying and Love the Sandbox · Canal: AI Engineer (E2B) · 59:30 · Assistir no YouTube
Tópicos: Agentes de IA, Cibersegurança e segurança de software, Engenharia de software com IA, Infraestrutura e hardware de IA
Matt, engenheiro da E2B, apresenta sandboxes como ambientes isolados para executar código de usuários e agents com mais segurança. Ele explica inicialização rápida, snapshots e retomada de estado, além de demonstrar desafios práticos sobre consumo de CPU, memória e disco, ciclo de vida, processos órfãos, atribuição de sandboxes e permissões do sistema de arquivos. A palestra também discute como equilibrar custo, velocidade, persistência e segurança ao operar sandboxes em escala. No fim, Matt responde a perguntas sobre usos em produção, GPUs, armazenamento, Kubernetes e o ecossistema de sandboxes.
Pontos-chave
Seção intitulada “Pontos-chave”- Sandboxes isolam código de usuários e agents para reduzir o risco de afetar outros usuários ou acessar recursos indevidos.
- A E2B busca iniciar sandboxes em menos de 100 milissegundos e permite salvar e retomar o estado por meio de snapshots de memória e sistema de arquivos.
- Snapshots facilitam a retomada do trabalho, mas também podem preservar processos antigos que precisam ser limpos.
- Operar sandboxes em escala exige controlar o uso de CPU, RAM e disco, além de acompanhar os recursos alocados.
- O tempo de vida de um sandbox deve acomodar a tarefa em execução e, depois, ser reduzido para liberar recursos.
- A limpeza de processos órfãos e o rastreamento de sandboxes são tarefas importantes de gerenciamento.
- Atribuir um sandbox por usuário, em vez de distribuir sandboxes em rodízio, permite que cada usuário retome o próprio estado.
- As permissões do sistema de arquivos devem limitar os locais em que o código pode ler ou gravar.
- A E2B usa VMs baseadas em Firecracker, oferece volumes compartilhados e, no momento da palestra, não oferece suporte a GPUs.
Capítulos
Seção intitulada “Capítulos”| Início | Capítulo | Resumo |
|---|---|---|
| 00:24 | Abertura e apresentação do workshop | Matt apresenta a E2B e explica que o workshop combina uma introdução a sandboxes com desafios no formato capture the flag. |
| 02:28 | O que são sandboxes e por que usá-los | A palestra apresenta o isolamento como forma de executar código de usuários e agents sem expor o computador ou servidor a riscos desnecessários. |
| 04:01 | Inicialização rápida, snapshots e retomada | Matt descreve a meta de iniciar sandboxes rapidamente e de salvar e restaurar memória e sistema de arquivos. |
| 06:05 | Ferramentas da E2B e início dos desafios | Ele apresenta os SDKs e a infraestrutura da E2B e orienta os participantes a acessar o primeiro sandbox. |
| 15:32 | Identificadores, templates e recursos do Linux | Os primeiros exercícios mostram como identificar um sandbox, inspecionar processos e resolver problemas de CPU, memória e disco. |
| 30:20 | Ciclo de vida e tempo de execução | A palestra explora como definir a duração de um sandbox para acomodar tarefas longas sem manter recursos ociosos por mais tempo que o necessário. |
| 39:10 | Processos órfãos e gerenciamento de sandboxes | Matt demonstra a limpeza de processos órfãos e explica a importância de rastrear sandboxes em uso. |
| 42:14 | Atribuição por usuário e permissões | Os exercícios seguintes modificam a atribuição em rodízio para associar cada usuário ao próprio sandbox e restringem caminhos de escrita. |
| 50:08 | Usos em produção e desafios de escala | A conversa aborda aplicações em produção e desafios de distribuir workloads, coletar dados e gerenciar armazenamento e recursos. |
| 55:27 | Agentes, orquestração e futuro dos sandboxes | Matt comenta a execução de agentes em sandboxes, a infraestrutura da E2B, o ecossistema ainda emergente e as considerações de segurança. |
Citações
Seção intitulada “Citações”Na E2B, buscamos iniciar sandboxes em menos de 100 milissegundos. — 04:01
Ao salvar tudo e garantir que continue lá quando o agent voltar, temos menos erros. — 05:03
A vantagem é retomar o estado antigo rapidamente; a desvantagem é que as coisas continuam como foram deixadas. — 39:40
É uma questão de facilidade versus segurança. — 58:40
Conceitos e entidades
Seção intitulada “Conceitos e entidades”- sandbox (conceito): Ambiente isolado usado para executar código sem interferir nos recursos de outros usuários.
- E2B (empresa): Empresa apresentada por Matt, que desenvolve infraestrutura e ferramentas de sandbox.
- Matt (pessoa): Engenheiro da E2B que conduz a palestra e o workshop sobre sandboxes.
- snapshot (conceito): Registro do estado de um sandbox, incluindo memória e sistema de arquivos, que pode ser retomado posteriormente.
- template (conceito): Estado preparado de uma VM que serve de base para iniciar cópias de sandboxes.
- orphan process (conceito): Processo que continua ativo após o trabalho que o iniciou e pode consumir recursos desnecessariamente.
- Firecracker (ferramenta): Tecnologia de virtualização mencionada como base das VMs usadas pela E2B.
- Nomad (ferramenta): Sistema de orquestração que Matt diz que a E2B está usando.
- Kubernetes (ferramenta): Sistema mencionado durante a conversa sobre orquestração e infraestrutura de sandboxes.
- Python (ferramenta): Linguagem usada em um dos exercícios para modificar a lógica de atribuição de sandboxes.
- JavaScript (ferramenta): Linguagem disponível, junto com Python, nos SDKs mencionados para a E2B.
Tradução completa (pt-BR)
Seção intitulada “Tradução completa (pt-BR)”00:24 E aí, pessoal. Beleza. Certo. Vejo que ainda tem gente chegando, mas vamos começar. Prazer em conhecer vocês. Sou Matt, engenheiro da E2B. Nós fazemos sandboxes. [suspira] Antes de começarmos, como vocês estão nesta manhã? >> Certo. Estou com a audição bem ruim. Não consegui ouvir. Então, como vocês estão nesta manhã? >> Certo. Ótimo. Certo, todo mundo está ao vivo. E também, de onde vocês são? Quantas pessoas aqui são de San Francisco? Moram em San Francisco. Certo, temos algumas pessoas que vieram de fora do estado. Certo, muita gente veio de fora do estado. Ótimo. Também vamos falar sobre sandboxes e depois fazer basicamente uma captura da bandeira. Não sei se vocês já participaram de uma captura da bandeira, mas vai ser uma série de níveis diferentes pelos quais vamos passar, resolver, e isso desbloqueia o próximo nível. Quanto às linguagens de programação que usamos, quantas pessoas aqui usam Python? Certo, a maioria usa Python. Ótimo. Nossos SDKs estão disponíveis em Python e JavaScript. Outra boa notícia é que não precisamos
00:56 programar nos primeiros níveis. Muitos deles vão ser configurações para entender como os sandboxes funcionam. JavaScript. Certo. Go, cadê meus engenheiros de Go? Ótimo. Aliás, estamos contratando pessoas que programem em Go para o backend. Então venham conferir nossa página depois disso ou durante a apresentação. Vamos ver. E quantas pessoas aqui não programam? Certo, ótimo. Então vamos começar. Opa. Certo. Não sei se
01:27 as pessoas conseguem acessar este link, mas, se vocês forem para este tinyurl.com, vão ver que ele dá acesso a um sandbox. Vocês precisam entrar na E2B. Mas, neste workshop, tudo são basicamente sandboxes até o fim. O que preparamos para vocês são vários desafios com problemas que surgem quando se usa um sandbox. Já vamos falar de visitar em um segundo. Vocês também podem usar o QR code. Todo mundo conseguiu acessar essa
01:58 página? Polegar para cima ou para baixo. Beleza. Certo. Se não conseguiram, não se preocupem. Vamos percorrer tudo juntos. A partir de agora, fiquem à vontade para começar a seguir as instruções e descobrir como hackear. Ou, se preferirem me ouvir falar sem parar sobre sandboxes, podem fazer isso e depois iniciar o sandbox — começar o CTF — junto comigo. Certo, só um pouco sobre a E2B. O que são sandboxes? Sandboxes basicamente permitem executar
02:28 código específico de cada usuário sem interferir nos outros usuários, certo? Muitas vezes, numa stack web tradicional, seria algo como: “Ei, aqui está uma página da web. É uma página estática. Você pode fazer coisas nela.” Talvez houvesse usuários que pudessem programar e quisessem usar algo como o Colab, onde você entra e pode brincar com o código. Talvez quisesse usar algo como AWS EC2, certo? Acessar e executar seu código. O que estamos vendo em muitas das tecnologias modernas com agents é que você tem esse ser mágico na nuvem, capaz de realizar todo tipo de tarefa muito legal, e uma dessas tarefas é programar. Há algumas maneiras de
02:59 fazer isso. Uma delas é simplesmente executar as coisas localmente no seu próprio computador, certo? Quem aqui já usou Codex ou Claude Code? Você pode dizer: “Ei, você tem todas as permissões de que precisar.” E ele pode sair por aí, apagar coisas, criar coisas, o que for. Alguns problemas que podem surgir são: ele vai usar toda a CPU, iniciar um monte de processos, apagar coisas que não deveria. Talvez consiga começar a acessar variáveis de ambiente. Há muitas coisas perigosas nisso. Então, a solução é: “Certo, vamos colocá-lo no servidor.” Bem, no servidor você tem problemas parecidos. Você tem
03:31 segredos, seu ambiente precisa ter tudo com que você quer que ele interaja. É aí que entram os sandboxes. Outra coisa um pouco diferente na forma como vemos sandboxes e outras coisas é que queremos poder iniciá-los muito rapidamente. Na E2B, nosso objetivo é iniciar sandboxes em menos de 100 milissegundos. Assim, você pode executar várias coisas ao mesmo tempo. Sim, e também há algumas coisas que tentamos
04:01 fazer com nossos sandboxes. Quando você entra em um sandbox, está trabalhando e, quando fecha o laptop e o abre de novo, volta ao seu estado anterior. Para nós, é a mesma coisa. Tentamos tirar um snapshot da memória e do sistema de arquivos. Assim, quando você para de trabalhar, pausa tudo, salva tudo em algum lugar no armazenamento e depois retoma. Isso é especialmente útil para agents, certo? Você tem um agent trabalhando. Talvez ele precise executar algum processo em outro lugar. Depois, quer voltar ao estado em que estava. Para o agent,
04:33 é como se ele não soubesse que o tempo passou e, por isso, espera que tudo esteja exatamente como estava quando parou. Então, ao tirar snapshots de tudo e garantir que tudo ainda esteja lá quando ele voltar, há menos erros. Nossa abordagem para esses sandboxes é basicamente iniciar primeiro os processos e, como eu disse antes, salvar o disco na RAM e retomar os sandboxes a partir daquele estado. Isso é um pouco diferente. Por exemplo, se você pensar no Docker, quando inicia uma imagem Docker, você
05:03 monta várias coisas e, quando o processo começa, é aí que você tem o comando de inicialização. Na E2B, partimos de tudo já em execução. Por exemplo, quando temos nossos templates — sobre os quais vamos falar daqui a pouco —, você inicia processos, e esses processos já estão em execução quando você volta ao sandbox. Certo. Também somos open source. Quanto à infraestrutura, vocês podem ver os links ali. Também podem pesquisar no Google. Nosso backend é em sua maior parte escrito em Go, por isso perguntei pelos engenheiros de Go. Estamos contratando com urgência. Nosso SDK também está disponível em Python e JavaScript. Estamos trabalhando para estendê-lo a outras linguagens, mas isso cobre vários dos nossos casos de uso. Certo. O uso normal dos sandboxes é assim: temos uma chave de API. Você acessa edb.dev e também pode consultar nossa documentação. Mas, para este workshop, não vamos precisar nos preocupar com nada disso, porque vamos fazer tudo dentro dos nossos próprios sandboxes. Vamos iniciar os sandboxes pelo nosso dashboard. Assim,
05:33 podemos, esperamos, começar a usar tudo bem rápido. Isso também deve eliminar alguns dos problemas que, segundo ouvimos, acontecem em workshops. Certo. E, de novo, acho que descobrimos que a maioria de nós já conhece Python, o que é bom. Mas, neste workshop, não vamos precisar programar nos primeiros níveis. Depois de passar, acho, do nível sete, aí começamos a precisar programar em Python ou JavaScript, se vocês quiserem. E teremos testes para agilizar as coisas. Teríamos gostado. Um dos desafios que tivemos ao pensar: “Ei, como
06:05 vamos…
06:36 assim, esperamos conseguir deixar tudo funcionando muito rapidamente. E isso deve eliminar alguns dos problemas que, segundo ouvimos, acontecem nos workshops. Certo. E, de novo, acho que descobrimos que a maioria de nós já sabe Python, o que é bom. Mas, neste workshop, não vamos precisar programar nos primeiros níveis. Quando passarmos, acho, do nível sete, aí começaremos a precisar programar em Python ou JavaScript, se você quiser. E teremos testes que tornam as coisas rápidas. Teríamos gostado disso. Um dos desafios que tivemos ao pensar em como…
07:06 Vamos demonstrar alguns dos problemas que encontramos com sandboxes. Muitos problemas aparecem em escala. Às vezes, quando você está gerenciando só uma ou duas sandboxes, é bem fácil. É só: “Ei, tenho uma sandbox, entro nela, pauso, retomo, sem problemas.” No entanto, quando você começa a lidar com centenas, milhares de sandboxes, as coisas começam a ganhar vida própria. Para isso, temos algumas simulações, basicamente, no workshop, que esperamos que sejam divertidas. Além disso, embora eu saiba que estamos em 2026…
07:37 e temos agents. A maioria de nós já não programa à mão — ou muitos de nós já não programam à mão. A maioria dos agents de IA conhece o SDK do E2B, então vocês poderão pegar o ID da sandbox que recebem em cada nível, passar para o agent e deixá-lo descobrir como escrever o código para vocês. Mas isso é para fins de aprendizado. Então, se quiserem fazer à mão, provavelmente é melhor. Certo. Também me pediram para mencionar isto: se vocês trabalham em uma startup, temos um programa para startups em que…
08:08 damos créditos e um plano gratuito. Certo. Vamos ao primeiro nível. Vamos voltar para… Deixa eu ver. Não sei se tem como deixar isto aberto, mas todo mundo conseguiu acessar esta URL? Sim. Legal. Certo. Vamos lá. Já deixei aberta, mas tudo bem. >> Certo. É tinyurl.comwh46sx6.
08:40 Não sei se tem um jeito fácil de manter isto na tela enquanto avançamos, mas todos vocês têm vizinhos, então podem simplesmente perguntar para a pessoa ao lado: “Ei, qual era mesmo o código, caso você precise de novo?” Vou dar mais cinco segundos. Podem fazer sinal de positivo quando tiverem conseguido acessar? Certo, parece que aquele pessoal ali conseguiu. Aqui, em geral, também. Legal. Certo, então o que temos aqui dentro já é uma sandbox. No topo, teremos…
09:11 Esta é nossa interface web para visualizar as sandboxes. E, de novo, como eu disse, ainda não precisamos programar. Este é o nosso painel. Dentro do painel, se quiser criar uma chave de API, vocês podem acessar as chaves de API aqui e criar uma, que depois podem conectar localmente. Mas temos esta interface linda, que vai nos dizer o que fazer. Dentro da sandbox, estamos iniciando um servidor web, e vamos subir até aqui, certo? Podemos acessar agora. E…
09:41 aqui está nosso laboratório. Certo. Nossa primeira tarefa é bem simples. Basicamente, vocês conseguem descobrir o ID da sandbox em que estão? Temos várias instruções para descobrir isso na própria sandbox. Vou mostrar um atalho. Na URL, na verdade, temos o ID da sandbox. Então podemos simplesmente copiar esse ID. De novo, os primeiros níveis servem principalmente para garantir que todos estejam orientados e consigam fazer as diferentes partes funcionarem. E vocês podem colá-lo aqui, certo? Verificamos e devemos estar prontos. Todo mundo? Então…
10:13 todo mundo conseguiu passar do primeiro nível? Certo. É difícil encontrar o ID. >> Bem, cada um vai ter um ID de sandbox diferente. >> Ah, aquele é nosso ajudante, um dos nossos funcionários de desenvolvimento de mercado da E2B ali atrás. >> Se quiser, pode vir aqui. Hã? >> Desculpe. >> O Wi-Fi não está funcionando. >> O Wi-Fi não está funcionando. Certo. Mais alguém está com problemas de Wi-Fi?
10:45 Acho que sim. >> Ótimo. Certo. Uma das… Certo, testei isto antes de chegar aqui. O Wi-Fi que deveríamos usar se chama algo como AI Engineer. Aqui está, está nestas placas. Wi-Fi AI Engineer. Se vocês se conectarem, talvez apareça só uma barrinha. O que devem fazer é, depois de conectar, desconectar e conectar de novo. Aí devem aparecer cinco barras. >> Certo. Não sei por que isso funcionou. >> Desculpe.
11:17 Você já conseguiu chegar aqui? >> Entendi. Certo. Então, vamos lá. Certo. Nesta tiny URL, todos devem receber um terminal, certo? Vocês terão que fazer login no E2B. >> Aumente a fonte. >> Ah, aumentar a fonte. URL.
11:50 >> Vou continuar dando zoom. >> Certo. URL. Todo mundo já conseguiu acessar? >> Volta. Certo. Podemos mostrar a URL mais uma vez. Depois disso, vamos ter que começar a cobrar, porque tempo de tela é caro. Certo. Temos mais uns dez segundos para tentar acessar esta URL, mas também posso dizer em voz alta. É tinyurl.com4…
12:22 whiskey hotel for 6 Sierra X-ray 6. Certo. Isso deve nos levar a um terminal. Vocês precisam se cadastrar. >> Sim, vocês precisam se cadastrar no EDB para usar isto. >> Hã. Além disso, a bela arte de ASI não fica tão boa na tela grande quanto fica em uma tela menor.
12:54 Legal. Podem levantar a mão? Quem conseguiu acessar esta página? Certo, quem não conseguiu? Não queremos deixar ninguém para trás. Vamos garantir que todos consigam fazer a configuração inicial, mas quem conseguiu acessar esta página já pode continuar avançando pelos níveis, se puder. Certo, vou dar mais um… Deixa eu ver.
13:29 >> Certo. >> Sim. Sim, está tudo rodando remotamente na sandbox, então esperamos não precisar de muita interação. Palavras famosas, ditas pouco antes de dar tudo errado. Certo. Para quem ainda estava carregando, quem ainda está esperando para tentar acessar a página? Um, dois. Ally, você consegue ajudar esse pessoal? Temos ajudantes que podem vir até aqui e ajudar a entender…
14:00 o que está acontecendo. Qual é o principal problema que ainda temos? É só a conexão com a internet. Certo. E, na pior das hipóteses, todo mundo aqui é gente boa, certo? Podemos formar duplas. Então, deixa eu ver. Podem levantar a mão? Quem ainda está tentando acessar a página? Um, dois, três. Certo. Podem levantar a mão as pessoas que são simpáticas e não se importam de sentar ao lado de alguém? Certo. Se ainda estiverem esperando, procurem alguém com a mão levantada. Aí podem formar uma dupla.
14:31 Certo. Quando chegarmos aqui… Certo. Sim. Desculpem, temos pouco tempo e queremos continuar. Mas, sim. Certo. Quando chegarmos aqui, devemos ter esta URL, onde nossa primeira sandbox será iniciada. Então podemos ir direto para ela. Certo. Todos devem chegar a uma página parecida com esta, que terá as instruções do nosso CTF. Legal. Levantem a mão. Sim. Além disso, vocês não sabiam, mas isto é um workshop interativo, tipo…
15:02 interativo, certo? Em que é: levantem a mão, abaixem a mão, levantem a mão. A próxima atividade é “O mestre mandou”. Mas, enfim, quem chegou até aqui? Levantem a mão. Ótimo. Certo. Quem conseguiu descobrir o ID da sandbox? Legal. Quem não conseguiu descobrir o ID da sandbox, mas ainda está aqui? Quem está com vergonha demais para dizer que não conseguiu encontrar o ID da sandbox? Certo. E, de novo, podemos simplesmente pegar o ID da sandbox na URL. Esse ID…
15:32 basicamente é o identificador do sandbox, certo? Então, depois que você tem um sandbox, vai querer um identificador para poder voltar a ele. No E2B, a maneira como construímos nossas URLs é basicamente a porta com a qual você está se comunicando, um traço, o ID do sandbox, ponto app. Assim, sempre que você iniciar um sandbox, poderá expor serviços que estejam escutando nessas portas e depois abrir conexões. Então, vamos terminar este primeiro nível. Certo. Uma das coisas que
16:04 acontecem é que, quando você tem usuários em um sandbox, há uma IA escrevendo código. Muitas vezes, a IA acaba escrevendo algo que faz alguma coisa que você não esperava. Enquanto preparávamos este workshop, descobrimos que esse problema aparecia bastante: tínhamos processos que consumiam muita CPU. Então, o que podemos fazer é iniciar este sandbox e, como vocês podem ver aqui em cima, estamos agora dentro de um sandbox novo, certo? Então, temos um sandbox novo, especificamente para este projeto, o que significa que podemos quebrar este sem quebrar o que fizemos inicialmente. Se quisermos reiniciar um
16:35 sandbox, temos este botão sofisticado aqui para recarregar, certo? E ele vai recarregar. Isso. Já que estamos aqui, devo apontar algumas coisas que estão acontecendo. Não precisamos nos preocupar muito com elas, mas servem mais como contexto sobre como gerenciamos nosso dashboard. Temos este terminal aqui, que nos permite conectar uma sessão de pty a um sandbox. Também temos o conceito de templates, que mencionei antes. Para nós, um template é uma VM capturada em um snapshot. Então, o que fizemos foi
17:05 iniciar uma VM, executar vários processos para iniciar o capture the flag e, depois, salvar isso como um template. Isso significa que todos vocês estão basicamente usando aquele sandbox que eu tinha iniciado antes e iniciando-o a partir de onde eu o havia retomado. Certo? Então, acabamos de fazer, sei lá, 200 cópias dessa coisa, o que é bem legal, só pelo fato de podermos fazer isso. Há muitos casos de uso para esse tipo de coisa, dependendo do que vocês fazem na empresa. Talvez queiram dizer: “Tenho este trabalho e quero que outras pessoas continuem de onde parei”. Ou, até mesmo, se estiverem trabalhando com ciência de dados
17:35 e coisas do tipo, certo? Digamos que vocês tenham vários dados em um dataframe e pensem: “Quero tentar modificá-los. Tenho uns cinco experimentos diferentes que quero executar”. Vocês podem pegar isso e criar cinco ramificações diferentes. Depois, em paralelo, iniciar cinco sandboxes com elas. Então, aqui em cima está apenas o ID do template que estamos iniciando. Agora que temos o ID do sandbox, quando recarregarmos esta página, voltaremos sempre à mesma página. E podemos nos conectar a ele. Outra coisa: digamos que, como vou mencionar mais adiante, teremos algum código para
18:06 quem estiver adiantando o trabalho. Vocês podem pegar o ID do sandbox, criar uma chave de API do E2B e, no código local, seja no Codex, no Claude Code ou em outra ferramenta, podem dizer: “Coloque isso num arquivo de variáveis de ambiente e use o E2B para se comunicar com o sandbox e resolver o desafio para mim”. Isso pode facilitar as coisas. Assim, vocês não precisam programar, porque, de novo, hoje em dia a maioria de nós deixa a IA programar por nós, ou algo parecido. Não deixem simplesmente que ela programe por vocês. Vocês devem sempre revisar o que a IA faz. Façam o que eu digo, não o que eu faço. Então,
18:37 certo. Cada um desses desafios, assim como o primeiro, é algo que podemos simplesmente colocar aqui em cima. Certo. Então, aqui está nossa tarefa de sobrecarga da CPU. Para quem não programa muito ou não mexe com Linux há algum tempo, temos instruções para descobrir o que está acontecendo. Certo? Podemos ver que temos outro terminal aqui. São sandboxes e terminais até onde a vista alcança. Isso abre outro pty para o sandbox local. Então, basicamente, as instruções dizem: “Temos uma CPU; há alguns processos consumindo muita CPU”
19:08 nestes primeiros níveis. Temos instruções sobre como descobrir o que está consumindo CPU, certo? Certo. Podemos listar o que está acontecendo. Temos este processo aqui em cima, que está em execução há algum tempo e consumindo 99,7% da nossa CPU. Provavelmente deveríamos encerrá-lo. Mas como se encerra um processo? Esqueci. Felizmente, temos instruções aqui de como fazer isso. Também poderíamos perguntar à nossa simpática IA, certo? Então, vamos encerrar esse processo.
19:38 Certo, temos o ID do processo aqui em cima, certo? Certo. Isso mostra nosso processo, quanto de CPU cada um desses processos está usando, a memória e assim por diante. Então, vamos encerrar o processo 1250. Certo. Agora que ele foi encerrado, identificamos que resolvemos o problema do processo que estava sobrecarregando a CPU. Copiamos este código incrível aqui. Voltamos ao nosso capture the flag inicial e desbloqueamos o nível três. Certo, todo mundo conseguiu fazer isso? Legal. Alguém ficou preso?
20:10 Não quero constranger quem ficou preso. Não? Legal. Certo. Então, podemos abrir o próximo nível. De novo, é a mesma coisa, certo? Recebemos um sandbox novo. Podemos abri-lo. Certo. E isso também acontece bastante: vocês têm um agent executando código em um sandbox. Vocês estão executando código em um sandbox. A memória está estourando, certo? Então, uma das coisas sobre esses sandboxes é
20:40 que há algumas compensações na quantidade de recursos que vocês usam. Muitas vezes, vocês vão querer… sei lá, digamos que há uma compensação: com vários CPUs, o processo vai ser mais rápido; com menos CPUs, vai ser mais lento. Além disso, em termos de utilização de recursos, um dos problemas que começam a surgir com frotas de instâncias é que há cotas limitadas para a quantidade de CPUs e de RAM que vocês podem usar. Então, há uma questão de equilíbrio: vocês podem simplesmente usar recursos em excesso? Vão querer saber: “Como posso
21:11 minimizar o uso de RAM?” De novo, neste passo a passo, podemos simplesmente navegar até aqui, entrar no sandbox e ver o que está consumindo nossa memória, certo? Depois, podemos encerrar o processo, como antes. Então, nos primeiros níveis, todas as instruções estão aqui. 124, 1248. Bam. E então recebemos nossa chave.
21:44 Certo. Estou indo devagar demais? Rápido demais? No ritmo certo. Bom. No ritmo certo. Certo. Legal. E, por fim: o que acontece quando começamos a encher o disco? Todas essas coisas têm recursos limitados, e vocês vão se deparar com isso mais cedo ou mais tarde. As coisas vão acabar estourando. Então, é o mesmo processo. Certo, vocês podem ver que estamos em um novo
22:14 sandbox. Podemos listar os arquivos por aqui, certo? Podemos ver que nossas instruções estão aqui. Também temos um README, caso queiram ver mais informações. Podemos ler o README. Certo, então. É isso. Certo. Vamos para cá. Aqui, enchemos o disco, certo? Então, é a mesma coisa. Podemos verificar o que está acontecendo
22:46 para descobrir o que está ocupando espaço no nosso disco. Certo. Então, precisamos descobrir qual caminho aqui está ocupando todo esse espaço, certo? Na verdade, antes tínhamos todas as nossas instruções aqui, mas, certo, podemos
23:17 ver aqui. Vamos remover esse cara. Certo. E, de novo, agora eu deveria dizer que conseguimos. Também temos um… Ah, era para colocar aqui.
23:47 Brincadeira. Certo. Então, aparentemente, os níveis fáceis
24:18 não eram tão simples. Então, em teoria, bem, o que podemos fazer é recarregar este… quebrei a demonstração. Tudo bem. Podemos começar uma nova. Vamos tentar de novo. E vamos fingir que não quebrei aquilo. Certo.
24:51 Certo, deveríamos ter conseguido simplesmente excluí-lo. Mas vamos fazer isso aqui, então. Certo, aí está. Então, certo. Tudo bem. Tudo bem. E então, a gente… pegamos o… era para colar o caminho ali, em vez de removê-lo. Acho que quebrei isso. E assim, todo mundo conseguiu chegar a essa flag
25:24 ou algo legal. Certo. Ótimo. Alguém não conseguiu chegar a essa flag? Certo. Então, rapidinho, sobre como resolvi essa. O que você faz é: no desafio de encher o disco, o que estamos procurando é o que está ocupando todo o espaço em disco. E o que precisamos fazer é encontrar, aqui em cima, nas dicas, você pode copiar o… o…
25:54 script para descobrir o que está ocupando todo o nosso espaço em disco. E então aqui deveríamos conseguir ver que temos este /tmp/selfone_discill.bin. E aí podemos simplesmente colá-lo aqui embaixo, no verificador de caminho. Certo. Depois, clique aqui para limpar. Isso vai executar o comando de exclusão para nós. E então devemos receber esta flag de tarefa concluída. Todo mundo conseguiu?
26:25 » Então… » Não entendi isso. » Você não entendeu o caminho. » O caminho do desafio de encher o disco. » Certo, um segundo. Então, você chegou ao nível quatro do desafio de encher o disco. » Legal. Na terceira tentativa dá certo. Certo. Podemos abrir a página do desafio. E então o que queremos fazer é…
26:56 aqui em cima, temos um código que podemos executar para descobrir quais arquivos estão ocupando mais espaço em disco. Certo. Até aqui, todo mundo conseguiu chegar? Legal. Certo. Então, quando executamos este dua, devemos conseguir encontrar o arquivo temporário, o arquivo em /tmp, este disk fill.bin, que está ocupando 512 megabytes de espaço em disco.
27:31 Você não tem isso. » O que você tem? » Desculpe. » Não tem nada aí dentro. Certo. Então, o que podemos fazer, né, e é aí que está a grande vantagem dos sandboxes: podemos reiniciá-los. Certo. Se você voltar aqui e clicar em “Start sandbox”, podemos recarregar o snapshot clicando neste botão de recarregar aqui em cima, certo? E assim, isso vai criar uma nova cópia para nós.
28:09 » Certo, todo mundo conseguiu? » Sim. » Sim, exatamente. É este botão aqui. Ele atualiza. E aí você pode ver aqui que diz: “Ei, comece aqui, abra esta página do navegador para este conjunto de tutoriais”. Vai dizer que retornamos, se for o mesmo… » E isso redefine para o original. » Exatamente. Isso mesmo. E é aí que… sim, dá para ver que nosso tempo de inicialização é bem rápido, certo? Clicando
28:41 aqui, conseguimos criar um sandbox relativamente rápido. E podemos criar quantos sandboxes quisermos. » Pergunta. » Sim. » Vocês não têm nenhum personagem engraçado com algum agent de suporte que vá fazer scraping disso ou coisas assim? Não teremos problemas? » Não. Sim, quer dizer… Isto é só um terminal mostrando o sandbox. Na maior parte do tempo, quando as pessoas interagem com isso, tudo é programático. Então, você tem um servidor web que acessa o sandbox programaticamente e executa código nele, puramente para fins de demonstração. E também para depuração
29:12 poder entrar rapidamente no navegador e abrir um sandbox pode ser útil. E também, aqui, meio que conseguimos abrir uma página web muito rápido para entrar e ver o que está acontecendo. » Sim. Sim. Sim. E era isso que eu estava dizendo. Então, sim. Vamos chegar a isso daqui a alguns níveis, quando começarmos a interagir programaticamente com esses sandboxes. Mas, por enquanto, queremos principalmente garantir que todo mundo esteja na mesma página sobre o que são CPU e RAM, e o que vai dar problema
29:42 quando começarmos a executar um monte de coisas diferentes que executam código arbitrário. Legal. Agora está todo mundo bem? Ótimo. Certo. Uma coisa que não fiz foi pegar o código daquele nível. Vou reiniciá-lo rapidinho. Só estou clicando em alguns botões.
30:20 Deixa eu encontrar nosso… nosso arquivo que está ocupando todo o espaço em disco. Este aqui. E então podemos conferir o caminho. Certo. Vamos clicar em limpar. Ótimo. Certo. E assim terminam nossas tarefas fáceis. Certo. Como todo mundo está se sentindo? Agora sabemos tudo sobre como mexer no Linux. Estão à vontade? Sim? Não? Ótimo. Vamos ficar de pé por um
30:52 minutinho, rapidinho. Vamos fazer o sangue circular e nos alongar um pouco. Também somos uma empresa de calistenia. Certo. Legal. Tudo bem. Então, era isso: “O que é Linux”. Nosso próximo conjunto de tutoriais vai nos levar a examinar o ciclo de vida do sandbox. Com um servidor comum, você
31:22 inicia o servidor e ele fica funcionando até você dizer: “Ei, quero desligá-lo”. Ou até a Amazon dizer: “Você não paga sua conta há um tempo. Vamos desligá-lo para você”. Ou, na verdade, se eles fazem isso de qualquer forma… bom, resumindo: com sandboxes, muita coisa do que você faz é pensar no ciclo de vida do sandbox. Há várias coisas com que precisamos nos preocupar aqui. Uma delas é: digamos que você tenha milhares ou dezenas de milhares de usuários. Você pensa: “Quero dar um sandbox para cada um deles quando acessarem meu aplicativo”. Bem, por quanto tempo esse sandbox deve durar? Certo? Intuitivamente, muita gente pensa: “Ei, vou dar o sandbox para eles. Eles acessam minha página web. Vou deixar o sandbox disponível por 20 minutos. Se não usarem, vou desligá-lo”. Mas, se você tem milhares de usuários e eles só vão usá-lo uma vez, ou talvez nem interajam com o sandbox, você está desperdiçando muitos recursos iniciando sandboxes que ninguém nunca vai usar. E aí entra outra possibilidade: talvez haja pessoas que entrem e saiam, certo? Elas chegam, experimentam por um segundo e pensam: “Ei, isso funciona?”. E depois vão embora. Nesse caso, o que você quer poder fazer é deixar o sandbox disponível, permitir que ele execute o comando inicial delas e, depois, fazê-lo desaparecer quando… bem, quando elas
31:52 executarem o comando e talvez voltem uns 10 minutos depois. Você quer que o sandbox esteja disponível quando elas voltarem. Então, no ciclo de vida do sandbox, é preciso garantir que você esteja usando o menor número possível de sandboxes ao mesmo tempo. No entanto, digamos que haja pessoas executando processos de longa duração. Certo. Digamos que você esteja fazendo ciência de dados, scraping da web ou qualquer outra coisa. Você não sabe quanto tempo as tarefas dos usuários vão levar, certo? Talvez os usuários cheguem e executem uma tarefa que leva 10 ou 15 minutos, e…
32:24 executarem o comando e talvez voltem uns 10 minutos depois. Você quer que o sandbox esteja disponível quando elas voltarem. Então, no ciclo de vida do sandbox, é preciso garantir que você esteja usando o menor número possível de sandboxes ao mesmo tempo. No entanto, digamos que haja pessoas executando processos de longa duração. Certo. Digamos que você esteja fazendo ciência de dados, scraping da web ou qualquer outra coisa. Você não sabe quanto tempo as tarefas dos usuários vão levar, certo? Talvez os usuários cheguem e executem uma tarefa que leva 10 ou 15 minutos, e
32:56 então eles fazem o que quiserem, certo? Então, a questão é: como encontrar o equilíbrio entre por quanto tempo você mantém os ambientes isolados ativos e não gastar dinheiro à toa? Para esta tarefa, vamos adotar uma abordagem para gerenciar nossos ambientes isolados: vamos permitir que eles permaneçam ativos por bastante tempo, certo? Vamos dizer: “Quando um usuário chega e executa um comando, queremos que o ambiente isolado continue rodando pelo tempo que for necessário. Mas, quando ele terminar a tarefa, vamos definir um tempo limite bem curto. Então
33:27 ele continuará ativo caso o usuário dê outro comando, mas depois será encerrado. Assim, podemos liberar esses recursos para iniciar outro ambiente isolado para outra pessoa. Vamos abrir isto, certo? Neste caso, não há código envolvido, certo? Então, tudo o que precisamos fazer aqui é pensar: quando essas pessoas chegam e executam comandos, por quanto tempo a máquina de estados deve continuar rodando, certo? Você pode ler aqui em cima: isso pode levar bastante tempo.
33:58 Digamos que temos uma tarefa e achamos que a tarefa inicial… devemos ter as instruções em algum lugar aqui. Temos uma política. Mas, basicamente, queremos permitir que essa tarefa continue pelo tempo que precisar. Depois, queremos encerrá-la após um minuto. Então, vamos dizer: queremos que este comando possa rodar por uma hora. Certo. Então, configuramos o comando para rodar por uma hora. Depois, podemos executar nossa tarefa. Certo. E tudo isso é simulado, porque não vamos
34:29 fazer vocês esperarem de verdade uma hora para uma tarefa rodar em um ambiente isolado. Depois, vamos dizer: “Quero que o ambiente isolado continue ativo por apenas um minuto. E então ele deve ser encerrado.” Certo, bem simples. O que acabei de fazer foi uma trapaça, mas esse é basicamente o objetivo: pensar que, quando temos um ambiente isolado e queremos que ele execute uma tarefa, queremos que ele permaneça ativo pelo tempo que a tarefa levar. Mas, depois, assim que recebermos o resultado, podemos dizer: “Ei, encerre
35:00 ele mais tarde.” Legal. Todo mundo conseguiu chegar a esta flag ou passei por isso rápido demais? Polegar para cima. Certo. Estou vendo muitos polegares para cima. Ótimo. Certo. E, se quiserem trapacear, podem simplesmente inserir o código aqui. Então, é “runtime lifetime” — duração da execução. Deixa eu ampliar para vocês.
35:30 Certo. Podemos continuar ou ajudaria se eu explicasse tudo de novo rapidinho para quem está aqui, só para mostrar como funcionou? Certo, vou explicar mais uma vez. Certo. Vou iniciar aquela tarefa de novo. >> É, como você está dizendo… >> Exatamente. >> Ou digamos que o usuário precise ler um arquivo grande ou queira processar um vídeo, certo? Você não sabe quanto tempo isso vai levar. Então, o que você quer
36:02 fazer é dar ao ambiente isolado um ciclo de vida longo para que ele possa concluir essa tarefa. Mas, depois que ele terminar a tarefa, você não quer deixá-lo ativo consumindo recursos. Então, define um tempo limite menor para depois, dizendo: “Ei, a menos que o usuário comece a interagir com isto, pause, encerre, coloque em… para que você possa retomar mais tarde.” >> Se for algo como um servidor web… >> Certo. >> Exatamente. Bem, uma sessão na nuvem é parecida, certo? Então, com uma sessão na nuvem… >> Sim, a velocidade importa, certo? E então é tudo…
36:34 essas coisas… você acaba tendo que lidar com uma troca entre velocidade e custo. Se um ambiente isolado está rodando, as coisas são rápidas. Se está pausado, é barato, porque você pode ter muitos deles pausados sem pagar por eles. Ou, se o limite for a CPU, você simplesmente não consegue rodar tantos ambientes isolados ao mesmo tempo. Mas, em algo como a nuvem, você não sabe quando a IA vai voltar para reutilizar aquele ambiente isolado, certo? Talvez esteja usando 20 ambientes isolados, certo? E usa o ambiente isolado e vai… Então, é aí que… É. Você
37:06 acaba tendo que fazer isso com seu ambiente isolado. >> É. Certo. Então, se você está falando de daemons, algo que precisa ser persistente e ficar rodando por muito tempo, talvez um ambiente isolado não seja a melhor opção. Você pode usar um, certo? Com certeza pode ter um ambiente isolado rodando por um dia, certo? Mas provavelmente existem métodos mais baratos ou mais tradicionais para fazer isso. Ainda assim, estamos rodando todas essas coisas dentro de um ambiente isolado agora, na verdade, dentro de vários ambientes isolados. Então, com certeza dá para rodar servidores web neles. Mas eles simplesmente não vão ser otimizados, por exemplo, em termos de CDNs e coisas assim.
37:37 É. >> Dá para usar isso no seu desenvolvimento principal? >> Dá. >> Você continua adicionando coisas ao ambiente isolado, e outras pessoas conseguem replicar… >> É. Então, como fazer fork das coisas. Exatamente. Mas é mais ou menos assim que muita gente usa essas coisas: você pode dizer ao ambiente isolado da IA: “Vamos instalar as dependências básicas, como você faria com o GitHub Actions.” Assim, você tem uma espécie de cache básico; depois pode puxar isso e
38:08 construir em cima, certo? E assim, se você estiver usando árvores de trabalho, certo, tem uma só. Cada árvore de trabalho tem… É. >> Isso. Certo. Enfim, aqui, vamos voltar ao nosso ciclo de vida, certo? Rapidinho, basicamente, queremos dar a ele um tempo de execução bem longo, certo? Certo. Então, aqui vamos dar a ele uma hora, mas, assim que terminar o comando, queremos reduzir o tempo limite para um minuto. Então, o que vamos fazer
38:39 é definir o tempo limite do nosso comando. Vamos executar uma tarefa falsa. E então vamos definir… Opa. Definir a duração de volta para algo bem curto. Certo. Isso deve nos dar… Ei, resolvemos este desafio. Legal. Viva! Concluído. Certo. E agora isso nos leva ao nosso próximo laboratório, que é sobre
39:10 vazamentos de processos em segundo plano, certo? Então, com certeza, quando você volta e reutiliza o mesmo ambiente isolado repetidamente, vai encontrar processos órfãos, certo? Basicamente, você inicia um processo e depois vai fazer outra coisa. Quando volta à sua máquina, se ela ainda estiver rodando, acaba acumulando um monte de processos diferentes ao longo do tempo, e isso pode prejudicar o desempenho do ambiente isolado. Por algum motivo, vemos isso acontecer bastante com ambientes isolados. Mas faz sentido, porque você está pausando seu processo e voltando a ele, em vez de obter
39:40 uma imagem nova toda vez. A vantagem é que você retoma aquele estado antigo: as coisas são rápidas e estão onde você as deixou. A desvantagem é que as coisas estão onde você as deixou — e você pode não ter feito a limpeza necessária. Muitas vezes, o que você precisa fazer é descobrir como encerrar seus processos órfãos. Na verdade, acho que muito do gerenciamento de ambientes isolados acaba sendo encerrar processos órfãos. E, muitas vezes, outra coisa relacionada a isso é que, quando você inicia ambientes isolados, precisa
40:11 para acompanhá-los. E, se você perder o controle dos seus sandboxes, precisa descobrir como encontrar os sandboxes que não está mais gerenciando e garantir que remova esses recursos. Então, aqui está uma demonstração de como encontrar nossos órfãos, certo? Temos nosso código aqui e, neste terminal bacana, podemos executar um código para descobrir quantos órfãos temos, certo? Certo. Aqui podemos ver que entramos no sandbox e temos três…
40:42 órfãos ativos, certo? Então, temos três processos filhos, certo? E, se fizermos uma busca por eles, o que podemos fazer é: muitas vezes, os processos que você deixou órfãos serão iguais. Aqui, conseguimos usar o grep para encontrá-los por meio desse nome bacana: por algum motivo, eles são chamados de “orphan worker”. No mundo real, infelizmente, eles normalmente não têm esse nome. Mas, por simplicidade, aqui vamos conseguir encontrá-los facilmente procurando apenas por órfãos. Então, tudo o que…
41:13 precisamos fazer agora é matar nossos processos filhos vazados. Certo. E, na verdade, enquanto faço isso, quantas pessoas aqui já tiveram problemas com processos órfãos em seus servidores comuns, com muitos processos em execução? Sim. Certo. O pessoal aqui deste lado. É um problema muito comum com o qual vocês vão se deparar. Então, vamos matar o processo 448. Depois podemos executar nosso script novamente e ver…
41:44 quantos órfãos temos. Agora sabemos que há dois em execução. Certo. Ainda temos nossos dois órfãos. Vamos matar os processos 449 e 50. Certo. Agora ele deve perceber. Pronto. Depois que eliminarmos todos os nossos processos órfãos, a página da web deve perceber que eles não estão mais lá e nos dar o código para avançar para o próximo nível. Legal. Todos conseguiram limpar seu ambiente e obter esse código? Legal. Alguém está tendo dificuldade para encontrar os processos em execução…
42:14 e ainda não conseguiu encontrá-los? Ótimo. Então, vamos pegar o flag e colocá-lo aqui. Certo. A próxima coisa sobre gerenciamento de sandbox que queremos abordar rapidinho são os nossos workspaces. Certo. Quando você começa a lidar com sandboxes, uma das primeiras coisas que faz é pensar: “Ei, tenho todos esses servidores, vou simplesmente distribuí-los aos usuários”.
42:45 Aqui, estamos chegando a uma abordagem ingênua de gerenciamento de sandbox: simplesmente distribuímos os sandboxes em rodízio. Então, em vez de acompanhar qual usuário recebe qual sandbox, simplesmente, sabe, você chega, recebe um sandbox e pronto. O que queremos fazer aqui, neste primeiro exercício de código, é examinar nosso código Python, onde temos basicamente um pequeno handler, e modificá-lo. Em vez de atribuir sandboxes em rodízio, vamos acompanhar qual sandbox cada usuário recebe.
43:17 Não queríamos sobrecarregar nossos servidores criando um monte de sandboxes de que não precisamos. Então, temos vários mocks que vão nos permitir testar o que acontece com nosso gerenciamento. Se abrirmos este terminal, podemos acessar nosso router.py ou router.js. Acho que a maioria de nós conhece Python, então hoje vamos usar Python. Certo. Também temos um README aqui, mas estamos ficando sem tempo.
43:47 Então, vamos ver se também tenho as instruções nesta página. Sim. Basicamente, no momento temos um código que funciona em rodízio. Queremos alterá-lo. Em vez de funcionar em rodízio, vamos atribuir os sandboxes aos usuários. Normalmente, você teria um banco de dados para acompanhar: “Ei, aqui estão todos os meus usuários. Aqui estão todos os sandboxes ativos de cada usuário.” Em geral, é útil manter isso persistente. Assim, você pode consultar dados históricos e descobrir se estava atribuindo sandboxes demais aos usuários ou o que estava acontecendo. Mas, aqui, vamos simplesmente…
44:19 usar este dicionário de atribuições. Tudo o que precisamos fazer é usar esta função assign sandbox aqui embaixo. No momento, ela simplesmente faz a atribuição. Então, vamos modificá-la rapidinho. Certo. Temos essas atribuições bacanas. Ah, certo, faltam 15 minutos. Vamos verificar se já registramos esse usuário nas nossas atribuições. Também é muito difícil digitar numa tela que fica lá longe. E vamos…
44:51 retornar assignments[user_id]. Já temos esta função aqui, que vai obter o ID do sandbox a partir de um sandbox. Então, vamos dizer sandbox_id = essa função. Certo. Basicamente, estamos seguindo essas etapas. Vocês devem ter instruções. Ah, não temos instruções. Certo, vamos trapacear. Alguém já passou deste nível? Certo. Algumas pessoas já passaram deste nível.
45:21 Então, dá para resolver dentro do tempo que temos aqui. Tudo o que vamos fazer é atribuir o ID do sandbox aqui e retornar esse ID. Certo? Assim, assignments vai ser nosso cache: “Ei, este é o ID atribuído a cada usuário”. Depois retornamos esse ID; caso contrário, teremos que criar novos sandboxes para todo mundo e retornar o ID do sandbox criado. Certo. Ah, ótima pergunta. Basicamente, o que…
45:52 queremos fazer — o objetivo é simplesmente dizer que queremos acompanhar qual usuário tinha qual sandbox. Então, você está criando um mapa de usuário para ID do sandbox. Certo? Esse é o único objetivo. Começamos sem acompanhar nenhum dos nossos sandboxes. Agora, cada usuário vai ter um sandbox dedicado para poder executar o código novamente no mesmo sandbox todas as vezes. Certo? E então devemos ter alguns testes aqui…
46:26 que podemos executar. E espero que vocês programem melhor do que eu. Linha 2. O que foi que eu errei? Certo, vou executar o teste rapidinho. E vou reprovar nos meus testes.
46:58 “Não é falso” não é verdadeiro. Um segundo. >> Desculpe. >> Ah, boa observação. Exatamente. Isso foi um teste para a plateia, e vocês se saíram bem. Certo, precisamos adicioná-lo a assignments.
47:32 Agora que estamos adicionando o ID do sandbox a assignments, devemos passar nos testes. Ótimo. E, agora que passamos, devemos ver aqui que concluímos… Vamos lá.
48:02 Certo. Lembram que contei como descobrimos os órfãos? Bom, agora temos vários órfãos em execução. Certo, pronto. Demorou um minuto, mas vamos pegar o próximo flag. Legal. Todos conseguiram? Legal. Vamos publicar isso aqui.
48:35 Certo. Permissões do sistema de arquivos. Acho que tanto o Claude Code quanto o Codex têm esse recurso: muitas vezes, você não quer que seus agents escrevam em todas as partes do sistema de arquivos. Há diferentes partes do sistema de arquivos nas quais você quer permitir que eles escrevam e leiam. Normalmente, isso seria especificado no seu agents.mmd, dizendo: “Ei, é aqui que quero que você escreva e é daqui que quero que leia.” Para este exercício, vamos simplesmente deixar isso fixo no código. Mas a ideia é a mesma: muitas vezes, você quer permitir leitura…
49:06 escrever partes do seu sistema de arquivos. Então, aqui, vamos dar uma olhada. Temos uma configuração de cache e um VCache. Certo, e então podemos fazer a mesma coisa. Então, aqui, basicamente temos um cache de templates e um cache de runtime. É aqui que, quando criamos nossos templates, teremos um cache onde vamos armazenar as informações do template, que talvez sejam lidas.
49:37 Temos um cache diferente no qual queremos escrever. Então, tudo o que vamos fazer é, para o nosso cache, referenciar este cache, que vamos escrever corretamente. E pronto. Legal. Então, esse foi bem rápido: tudo o que estamos fazendo é garantir que estamos escrevendo no nosso cache de runtime. Certo. Neste ponto, vamos ver. Acho que vocês conseguem fazer o resto disso
50:08 por conta própria. Temos cerca de 10 minutos para falar sobre sandboxes. Então, é isso. Espero que tenha sido uma boa introdução aos problemas que vocês vão encontrar com seus sandboxes, no que diz respeito a gerenciar o que pode fazer o quê e o que pode ler o quê. Temos mais ou menos oito níveis. Na verdade, vou deixar isso com vocês. Acham que seria útil continuar passando por todos eles ou seria mais divertido só conversar sobre sandboxes? >> Certo, vamos falar sobre sandboxes. Ótimo.
50:40 Vamos ver. Quem aqui está usando sandboxes em produção atualmente? Uau. Aquele pessoal lá atrás está usando sandboxes. Mais alguém aqui está usando sandboxes? Aquele pessoal ali. O que vocês estão fazendo com sandboxes? AgentWorks. >> Workloads de agents. Legal. Vocês precisam de…? >> Ah, certo. Ninguém é perfeito. >> Ainda não. >> Certo. O Travis está ali. Vocês deviam conversar com ele. E o que vocês fazem?
51:10 >> Certo, legal. Uhu! Ótimo. É, é. Vocês encontraram algum dos problemas que acabamos de abordar? >> Ainda não. Ah, certo. Entendi. É, é. Parte do que fazemos é tentar evitar que vocês encontrem problemas. Mas, como usuário, sempre vão encontrar alguma situação em que algo está acontecendo no sandbox e vocês precisam entrar, depurar e descobrir por que aquilo está falhando. Ótimo. E temos algumas pessoas usando sandboxes aqui. Sim. >> Então, tenho um caso de uso um pouco diferente.
51:41 >> Sim. >> Certo. Desculpem. Só para todo mundo ouvir: vocês têm o vanilla em produção no laptop. Certo. >> Aí quero distribuí-lo por várias GPUs, que são pequenas, o que vocês chamam de GPUs pequenas. >> Certo. >> E coletar os dados de volta. >> Certo. Os processos ficam aqui e estão distribuídos por redes e provedores diferentes, como vocês chamam. Isso. Então, basicamente, você está dizendo que tem
52:12 seu código local, localmente, e quer colocá-lo em várias GPUs distribuídas, processar a workload e depois mandar tudo de volta para o local. Certo. >> Quero os dados de volta. >> É, então você quer os dados de volta. Isso. >> É, então, no momento, não oferecemos suporte a GPUs, mas esse é, claro, um caso de uso comum. Quando você inicializa esses contêineres — ou seja lá o que forem —, no nosso caso usamos bastante VMs, mas muita gente também usa contêineres. Um caso de uso comum é dizer: “Ei, pegue a saída do que estiver rodando e envie uma requisição POST de volta para casa com os dados que eu quero que ele tenha.” Isso
52:46 depende de várias coisas. Conforme o tamanho da workload, vocês vão ter gargalos e desafios diferentes. Uma das coisas mais estranhas dos sandboxes é que, quando você está executando só alguns, tem certos problemas, como: “Ei, por que esse comportamento? Por que um ou dois sandboxes estão falhando?” Quando você está lidando com muitos sandboxes, os problemas passam a ser: como gerenciar tudo isso? O simples overhead de logging: como acompanhar tudo isso? Como garantir que estou atribuindo todos esses… acompanhar
53:18 a rede das máquinas em que eles estão rodando, certo? Cada máquina só consegue se comunicar com um certo número de sandboxes de cada vez. Mas, é, definitivamente, se vocês estiverem usando GPUs, o EDB não oferece suporte a GPUs. E acho que é aí que a solução de sandbox talvez não seja a ideal. Mas por que vocês precisariam de sandboxes para isso, em vez de simplesmente usar a GPU? >> Porque posso obtê-la em qualquer lugar, a qualquer custo. >> Entendi. >> Quero
53:52 isso. >> Faz sentido. Sim. E esse é um caso de uso comum. Só não sei o suficiente sobre isso para dar uma boa resposta, eu acho. Legal. E temos outra pessoa aqui usando sandboxes. Certo. >> Algo com Kubernetes. >> Cloud e Kubernetes.
54:24 >> Sim. Então, certo. Uma das perguntas é: como lidar com o armazenamento ao longo do tempo? Como fazer a poda dos recursos que vocês criam? Um dos problemas dos sandboxes é que dá para criar muitos, mas aí surge a questão: onde armazená-los? Esse é um desafio ativo em que estamos trabalhando no momento. Se isso interessa a vocês, estamos contratando. E, de novo, se forem para a área de Go, estamos contratando engenheiros de Go. Há muitos desafios bem interessantes: como otimizar velocidade e desempenho e, especialmente no armazenamento, como lidar
54:56 com a compressão e esse tipo de desafio. >> Volumes. >> Desculpe? >> Volumes. >> Volumes, certo. Ah, sim, também temos volumes. Se vocês têm recursos compartilhados que várias coisas podem usar, volumes são ótimos para isso. Mas acho que tudo isso ainda está bem no começo e ninguém sabe para onde vai. Então, vocês, pessoas inteligentes nesta sala, vão encontrar soluções melhores para otimizar as coisas. Não sei se essa é uma boa resposta. Mas, sobre sua pergunta a respeito da nuvem: dá para executar na nuvem em
55:27 sandboxes com bastante facilidade. Onde estávamos? Então, precisa ser assim, certo? Do mesmo jeito que iniciamos esses aqui, podemos simplesmente dizer: template = acho que o Claude deveria iniciar um Claude Code. Estou supondo o que as coisas fazem. Certo. Acho que temos o Claude aqui, certo? Então, sim, dá para executar o Claude em um sandbox. Também dá para executar o OpenCode, certo? O Codex em um sandbox. Basicamente, eles nos dão lugares onde podemos executar agents remotamente ou localmente.
55:58 Você pode fazer o agent se comunicar com ele. E obtém a mesma coisa. Mas, quanto ao Kubernetes, somos baseados em Firecracker e estamos tentando… há alguns problemas técnicos com o Kubernetes que ainda não resolvemos completamente. Então, por enquanto, estamos usando o Nomad, mas trabalhando para migrar para o Kubernetes. Sim. >> Legal. Entre sandboxes.
56:30 >> Sim. É, é. Isso é definitivamente comum. Com certeza dá para fazer. Não fizemos isso neste exercício. O que fizemos aqui foi mais ou menos deixar você como coordenador, certo? Basicamente, você clicou em algo e disse: “Ei, inicie um novo sandbox a partir deste template.” Isso não foi automatizado neste caso porque eu não queria ter que fazer todo mundo pegar suas API keys. Também não confiei em mim mesmo — isto está sendo gravado — para não expor minhas próprias API keys colocando-as na tela. Mas, sim, com certeza dá para fazer isso.
57:02 É meio legal ter esse efeito de inception: você tem um sandbox e, então, ele cria mais coisas. >> Legal. Temos tempo para mais duas perguntas. Sim. >> Então, como é o ecossistema desses sandboxes depois de tudo isso? Você acha que vai existir um ecossistema como o do Docker, com sandboxes por toda parte? >> Sim. Então, a pergunta é: como será o ecossistema dos sandboxes? Vai ser como o do Docker? E quero dizer, tudo isso ainda está no começo, né? Esses agents de IA têm, o quê, uns dois anos; LLM
57:33 como serviço, uns cinco anos. Ninguém sabe como será o ecossistema, mas, definitivamente, conforme as pessoas criam coisas legais, tendemos a padronizá-las e a compartilhar como fazer. E isso leva a… Sim, é aí que entram nossos templates, né? Aqui, por exemplo, eu tinha um template, e 200 de vocês puderam reutilizar esse mesmo sandbox sem muita… Sim, estamos indo nessa direção, mas só o tempo dirá. Sim.
58:09 >> Na verdade, internamente na E2B, estamos executando… Sim, executamos localmente, especialmente para testes, né? Porque executar na nuvem é simplesmente um transtorno. Mas, quanto a… Sim, na verdade, estamos fazendo bastante desenvolvimento local. >> Sim. Então, é aí que nossos sandboxes têm regras diferentes que você pode definir para a rede.
58:40 É aí que, se você der acesso a secrets, definitivamente vai querer impedir o que ele poderá enviar para fora. Se ele não tiver secrets, ou só tiver chaves de desenvolvimento, talvez… E é isso mesmo. É a facilidade versus a segurança. Legal. Mais alguém? Uma vez, duas vezes. Enfim, espero que todos tenham se divertido. Vocês podem concluir esses desafios por conta própria. Obrigado por terem vindo e, mais uma vez, sou Matt, da E2B. Foi um prazer conhecer todos vocês. >> [aplausos]
59:30 [música]
Transcrição original
[00:24] Hey y’all. Okay, cool. All right. So, I see people still trickling in, but uh we’re going to go ahead and get started. Uh so, nice to meet y’all. Uh I’m Matt. I’m an engineer from E2B. We do sandboxes. [sighs] Uh so, before we get started, uh how you all doing this morning? >> All right. So, my hearing is like really messed up. Uh I couldn’t hear that. So, how are we doing this morning? >> All right. Great. All right. So, everyone’s live. Uh and uh also, where are we all from? So, how many people here are from San Francisco? Uh based out of San Francisco. Okay, we got a
[00:56] couple uh coming out of state. All right, a lot of people coming from out of state. Great. Uh also uh we’re going to be uh talking sandboxes and then doing uh basically a capture the flag. Uh I don’t know if you all have done a capture the flag before, but uh what it’s going to be is it’s a series of different levels that we’re going to go through uh solve it and that unlocks the next level. Um uh as far as programming languages that we use, uh how many people here use Python? Okay, most of us use Python. Good. Uh so our SDKs in both Python and JavaScript. Uh good news also is that we don’t need
[01:27] to code at all for the first couple levels. A lot of these are going to be configs kind of looking at how sandboxes work. Uh JavaScript. Okay. Uh Go, where’s my Go engineers? Great. We are hiring by the way uh for people that uh uh code in Go uh for the back end. Uh so uh come check out our page after this or during this. Um let’s see. And then how many people here don’t code at all? All right, great. All right, so let’s get started. Uh, oops. So, all right. I don’t know if
[01:58] people can go to this link, but if you go to this uh tinyurl.com, y’all can see that if you go there, uh, that’ll give you a sandbox. Uh, so you have to log into E2B. Um, but what this workshop is is everything is basically sandboxes all the way down. Uh so what we put together for you is uh a bunch of different challenges that are issues that you run into running a uh sandbox. Um we’ll worry about visiting in a second. Uh and then also you can just do the QR code. Uh everyone able to get to that
[02:28] page? Thumbs up, thumbs down. Cool. All right. Uh and if you can’t, don’t worry about it. We’ll be walking through it. So at this point, feel free to uh start going through the instructions, figuring out how to hack away. Uh or if you actually want to listen to me drone on about sandboxes, you can do that instead and then go uh uh do the sandbox uh start the CTF uh with every with me. Okay, so just a little bit about EDB. Uh so what are sandboxes? Uh sandboxes are uh basically let you run user specific
[02:59] code uh without messing with other users, right? So a lot of the time uh with a traditional web stack, it would be like, hey, here’s a web page. It’s a static web page. You can go do stuff. uh you know maybe had users that could code and what they wanted to be able to do is use something like collab uh where you go in there and you can you know play around uh you might want to have like AWS EC2 right get into that run your code uh what we’re seeing with a lot of the modern stuff with agents is you know you’ve got this magical being in the cloud that can do all sorts of really cool tasks and one of those tasks is coding um now there’s a couple ways you
[03:31] can do that one thing is you can just run things locally on your own computer right who here’s used like codeex cloud code, right? Uh so you can be like, hey, you have all the permissions you want to do. Uh and it can go run around and then delete things, create things, whatever. Uh some of the problems that you run into are, you know, it’ll use up all your CPU. It’ll spawn a bunch of processes. It’ll delete things it’s not supposed to. Maybe able to start accessing environmental variables. Uh there’s a lot of things that are dangerous about that. Um so that’s where it’s okay, hey, let’s put it in the server. Well, on the server, you have similar problems. you’ve got
[04:01] secrets, you’ve got uh your environment is you need to make sure that everything that you want it to be able to interact with uh is present. Uh and that’s where sandboxes come in. Uh also uh with uh one thing that’s a little bit different uh the way that we view sandboxes and other things is that sandboxes you want to be able to very quickly spin these up. Uh EDB we sp we aim to uh spin up sandboxes in less than 100 milliseconds. Uh so that way you can run multiple things at the same time. Uh so yes uh also so with our sandboxes uh there’s a couple things that we uh try
[04:33] to do. So it’s uh when you go into a sandbox uh you’re working and uh like when you close your laptop you open your laptop again you’re back into your state. Uh for us it’s uh same thing. So we try to uh snapshot the memory, snapshot the file system. So that way uh whenever you stop working you pause everything, save everything to storage somewhere and then resume it. Uh agents especially, right? So you’ve got an agent working away. Uh maybe it has to go do some sort of process elsewhere. Uh and then it wants to come back uh to the state it was in. Uh for the agent, it
[05:03] kind of doesn’t know the time has passed and so it’s expecting everything to be exactly the way it was when it uh left off. Uh and so by snapshotting everything and making it so everything is still there when it comes back uh makes it so you get less errors. Um so yeah the way our approach to these sandboxes is basically we start the processes first uh and then we as I just said before we’re uh saving the disk in RAM uh and we’re resuming sandboxes from that state uh so that’s a little bit different like if you think about docker when you start a docker image uh you
[05:33] have kind of you build up a bunch of things uh and then when the process starts uh that’s where you have your start command uh for E2B basing from everything already running. Uh so for instance you uh when we have our templates uh which we’ll talk about in a bit uh what you’re doing is uh you start processes and then those processes are already running when you come back to the sandbox. All right. Uh we’re also open source uh and so for infra uh you can see our links there. You can also Google uh that
[06:05] we’ve got our back end’s mostly in Go uh which is why I asked about the Go engineers. We’re desperately hiring. Uh and then also our SDK is in Python and JavaScript. uh working on extending that to other languages, but that covers quite a few of our use cases. All right. So, normal usage of sandboxes are uh we have an API key. You go to edb.dev uh and then you can also go read our docs. However, for this workshop, uh we’re not going to need to worry about any of that because we’re just going to do everything inside of our own sandboxes. Uh we’re going to spawn the sandboxes through our dashboard. Uh that
[06:36] way we can hopefully get uh up and running very quickly. uh and uh that should eliminate some of the issues that we’ve heard happen in workshops. So, all right. And again, uh I guess we found out most of us already know Python. Uh which is good. Uh but for this workshop, we’re not going to need to code uh for the first several levels. Uh once we get past, I think level seven, that’s when uh we start needing to code in Python or JavaScript if you want to. Uh and we’ll have tests that make things uh fast. Uh we would have liked it. Uh one of the challenges that we uh had when coming up with hey how do
[07:06] we demo uh some of the issues that we run into sandboxes is uh a lot of issues happen at scale. Uh so sometimes when you’re managing just like one or two sandboxes it’s pretty easy. It’s just like hey I’ve got one sandbox I go into it pause it resume it no issues. Uh however uh once you start to deal with hundreds of sandboxes, thousands of sandboxes uh things start to take on a life of their own. uh for that we have some uh basically simulations uh in in the uh workshop uh which hopefully are fun. Uh also uh even I know it’s 2026
[07:37] and we have agents uh so most of us don’t actually code by hand anymore or many of us don’t code by hand anymore. Uh you so most of the uh AI agents uh know the ED SDK and so what you’ll be able to do is uh grab your sandbox ID that you get for each of the levels, give it to your agent and uh let the agent just figure out how to write the code for you. Um, but this is for learning purposes. So, if you want to do it by hand, it’s probably better. All right. Also, uh, I’m supposed to point this out. Uh, if you’re at a startup, we have a startup program, uh, where,
[08:08] uh, we give, uh, credits and, uh, free plan. All right. So, let’s get to the first level. So, let’s go back to Let’s see. I don’t know if there’s a way to keep this up, but was everyone able to get to this, uh, URL here? Yep. Cool. All right. So, let’s go there. I already have it open, but that’s fine. >> Okay. So, it is uh this tinyurl.comwh46sx6.
[08:40] Uh I don’t know if there’s an easy way to keep this up on the screen while we’re going, but uh all of you have neighbors and so you can just go to your neighbor and be like, “Hey, what’s what’s that code again if if you need it again?” Uh so, I’ll give you another five seconds. Can I just get a thumbs up as people have gotten there? Okay, it looks like those guys over there are good. Over here generally good. All right, cool. All right, so what we’re inside of here is already a sandbox. All right, so at the top, what we’re going to have is uh
[09:11] so this is uh our uh web UI for viewing our sandboxes. Um and again, as I said, we don’t need to code yet. Uh and so this is our dashboard. uh inside of the dashboard, if you want to uh make an API key, you can uh you can go into your API keys here uh and uh create an API key, which you can then uh hook into this locally. However, we’ve got this gorgeous UI uh that’s going to tell us what to do. Uh so inside of the sandbox, what we’re doing is we’re spawning a web server, and we’re just going to go up here, right? So, we can go there now. Uh and
[09:41] so here is our uh lab. All right. So, uh our first task is very simple. Uh it’s basically can you find out the sandbox ID that you’re inside of? Uh now we have a bunch of instructions for how to get that from the sandbox itself. Uh I’m going to show you a cheat code. Uh now in the URL we actually have the uh ID of the sandbox. Uh and so we can just copy that uh ID. Uh again our first levels are mostly just to make sure that everyone’s oriented and they can get the different pieces working. Uh and you can just paste it here, right? We check it and uh so we should be good. Everyone So
[10:13] has everyone been able to get past the first level? Okay. Getting the ID is hard. >> Do Well, everyone’s going to have different sandbox IDs. >> Oh, that is our helper, one of our uh [laughter] uh go to market people from E2B back there. Uh uh just if you want to come up here. Huh? >> Sorry. >> The Wi-Fi is not working. >> The Wi-Fi is not working. All right. Anyone else having Wi-Fi issues?
[10:45] I guess. >> Great. All right. Uh, so one of the Okay, so I tested this before I came in. Uh, so the Wi-Fi that we’re supposed to be using is it was like AI engineer something. Here we go. It’s on these things. Uh, a engineer uh, Wi-Fi. If you connect, you’ll have one bar possibly. What you do is you dis after you’ve connected, disconnect and reconnect, and it should give you five bars. >> Okay. I don’t know why that worked. >> Sorry.
[11:17] You got here already or no? >> Gotcha. Okay. So, all right. All right. So, set up. So, okay. At this tiny URL, this should give everyone a terminal, right? You’ll have to log into E2B. >> Make the font bigger. >> Oh, make the font bigger. URL.
[11:50] >> I’m just going to keep zooming in. >> Okay. URL. Everyone had already gotten there. >> Go back. Okay. We can give you the URL one more time. Uh after this we have to start charging because uh screen time’s expensive. All right. Got about 10 more seconds to try to get to this URL, but uh I I can also say it out loud. This is uh tinyurl.com4
[12:22] whiskey hotel for 6 Sierra X-ray 6. Okay. And that should bring us to a terminal. You need to sign up. >> Yes, you do need to sign up for EDB to use this. >> Huh. Also, beautiful ASI art does not look as good on the big screen as it does on a smaller screen.
[12:54] Cool. Uh, can I get a show of hands? Who was able to get to this page? Okay, who was not able to get to this page? All right, we don’t want to leave you guys behind. We’re going to make sure that we get the first setup part, but uh for those of you that were able to get to this page, you’re good to go ahead and keep going through levels if you’re able to. All right, I’m going to give another Let’s see.
[13:29] >> Okay. >> Yeah. Yeah, it’s everything’s running remotely in the sandbox, so hopefully we don’t need much back and forth. Uh, famous last words. All right. Uh, can I get So, for people that were still loading, uh, who’s still waiting to try to get to the page? One, two. Uh, uh, Ally, are you able to help these guys out? Uh so we’ve got our uh helpers that can come through and uh help debug
[14:00] what’s going on. Uh what’s the main issue we still have? It’s just the internet connectivity. Okay. And then worst case, uh everyone here’s friendly, right? Uh what we can do is we can partner up. Uh and so uh let’s see. Uh can I get that show of hands? And who’s still trying to get to the page? One, two, three. Okay. Can I get a show of hands of uh people that are friendly and don’t mind sitting next to somebody? All right. So, if you’re still waiting, look around for someone that’s got their hand raised. Uh, and it can uh kind of
[14:31] pair up. All right. So, once we’re here, All right. Yeah. Sorry, it’s uh we’ve got limited time and we want to keep moving. Uh but, uh yeah. All right. So, once we’re here, uh we should have this URL now uh that our first sandbox is going to spawn for us. And then we can just go straight to that. All right. And so, everyone should get to a page that looks something like this. Uh that’s going to have uh our CTF instructions. Cool. Show hands. Yeah. Also, you guys didn’t know this, but this is like an
[15:02] interactive uh workshop, right? Where it’s Raise your hand, lower your hand, raise your hand. Uh Simon says is next. Um but yeah, so who got here? Show hands. Great. All right. And then so who was able to find out their sandbox ID? All right. Cool. Who was not able to find out the sandbox ID, but is still here? who is too embarrassed to say that they couldn’t find their sandbox ID. Uh, okay. And again, so we can just pull the sandbox ID out of the URL. Uh, this ID
[15:32] basically is is identifier for the sandbox, right? So once you have a sandbox, you’re going to want an identifier so that you can go back to that sandbox uh for E2B, the way that we construct our URLs uh is basically the port that you’re talking to dash uh the sandbox ID uh.app. And that way whenever you spin up sandbox, you can expose services listening to those ports. uh and and then uh get coms open. So we’ll uh refinish this uh first level. All right. So one of the things that
[16:04] happens uh uh is once you’ve got users in a sandbox, you’ve got AI writing code. Uh a lot of the times what’ll happen is the AI will write some something that does something that you’re not expecting it to do. Uh it turned out while writing uh this workshop, we ran into this issue a lot that we had processes that just took lots of CPU. So, what we can do is we can start this sandbox and you’ll see up here, right? We are now inside of a new uh sandbox, right? So, our new we got a new sandbox specifically for this uh project, which means we can break this and we’re not going to break our initial stuff. Uh if we want to restart a
[16:35] sandbox, we’ve got this uh fancy button over here to reload, right? And then it’ll reload it. Yes. Uh while we’re here, I should kind of point out some of the things that are happening uh that we don’t need to worry about too much, but more just kind of framework on how uh we just manage our dashboard. Uh we’ve got this terminal here that lets us uh connect a pty uh session to a sandbox. Uh and so uh we have this concept of templates which I mentioned earlier. So a template uh for us is that snapshotted uh VM. And so what we’ve done is we
[17:05] started a VM, ran a bunch of processes to start the capture the flag uh and then we saved this as this template which means all of you uh are basically taking that sandbox that I’d started before uh and then you’re starting it where I’d resumed it. Right? So we just made I don’t know 200 copies of this thing uh which is pretty cool uh just but that we can do that by itself. Uh there’s a lot of use cases for this kind of thing depending on what you’re doing at your business uh that you’ll want to be like hey I’ve got uh this work I want other people to continue it. Um and or even like if you’re doing data science
[17:35] stuff, right? So let’s say you’ve got a bunch of uh data in a data frame. You’re like, “Hey, I want to try mutating this. There’s like five different experiments I want to run.” You can take that, fork that into five different things. Uh and then in parallel uh spin that up into five different sandboxes. So uh this up here is just the template ID that we’re spawning. Uh and then now that we have the sandbox ID, uh when we re reload this, we’ll go back to the same page over and over again. Um and we can connect to that. Uh one thing also is so let’s say that uh uh I mentioned later on we’re going to have some code uh for
[18:06] those of us that are jumping ahead. You can take the sandbox ID you can create an EDB uh API key uh and then in your local uh you know codeex cloud code whatever uh you can be like hey stuck these in environmental uh file use EDB to go talk to the sandbox and solve the challenge for me. Um, and that can make life easier. So that way you don’t have to code because again, uh, most of us are just letting the AI code for us nowadays or in some way. Uh, don’t just let it code for you. Uh, you should always review what the AI does. Um, do what I say, not what I do. Uh, so,
[18:37] right. So, each of these, uh, challenges is going to have, uh, just like the first one, we can just stick this up here. All right. And so, here’s our CPU uh, runway task. Uh for those of us that haven’t coded a lot, haven’t messed around with Linux recently, uh we’ve got instructions on how to uh figure out what’s going on. Right? So we can see here uh we’ve got another terminal. We’re sandboxes and terminals all the way down. Uh this is opening another pty into the local uh sandbox. Uh and so basically uh our instructions here, hey, we’ve got a CPU uh we’ve got some processes taking a bunch of CPU uh
[19:08] for these early levels. We’ve got instructions uh how to find uh what’s taking up CPU, right? All right. And so we can list here, hey, what’s going on? And we have this uh process up here uh that’s been running for a bit, taking up 99.7% of our CPU that we probably uh should kill. Well, how do we kill uh a process? I forgot how. Uh but luckily, we have instructions here for how to do it. Or could also ask our friendly AI, right? So, what we’re going to do is we’re going to go ahead and kill that process.
[19:38] Uh right, so we got the process ID up here, right? Right. So, this is showing our process uh how much CPU each of these guys is taking uh memory uh so forth. Uh and so we’re going to go kill 250 uh 1250. Right. Now that he’s dead, we have now identified, hey, we have solved our runway process. We copied this amazing code here. Go back to our uh initial capture the flag. And we’ve unlocked level three. All right, everyone able to do that, right? Cool. Anyone stuck?
[20:10] I don’t want to embarrass their stock. No. Cool. All right. Then we can open up our next level. Okay. And again, same thing, right? So we get a new sandbox. We can open this up. Right. And so this is another thing that happens a lot, right? You’ve got an agent running code in a sandbox. You’ve got you’re running code in a sandbox. Uh you’re blowing up memory, right? So, one of the things about these sandboxes is
[20:40] uh you’ve got some trade-offs in the amount of resources that you’re using. Uh a lot of the times you’re going to want to have I don’t know uh let’s say uh you know there’s a trade-off between if you have multiple CPUs, you’re going to run faster, fewer CPUs, it’s going to go slower. Also, in terms of resource utilization, uh one of the things that you start to run into uh with fleets is uh you have limited quotas on how many uh CPUs and how much RAM you’re able to have for your instances. Uh so there’s trade-offs uh on can you just overuse it? So you’re going to want to be like hey how do I
[21:11] minimize uh my RAM utilization. So again uh in this walkthrough we can easily go through here and then we can go into our sandbox show what’s using up our memory uh right and then we can kill it right same thing. So for the first couple levels, all these instructions are here. Uh 124 1248. Bam. And then we get our key.
[21:44] Okay. Am I going too slow? Too fast. Right speed. Good. Right speed. Okay. Cool. All right. And then so finally it’s uh hey what happens once we start filling our disk right so all these things have limited resources uh and all these things you’re going to run into at some point or another things are going to blow this up so same process um right you can see we’re in a new
[22:14] sandbox we can ls around right we can see hey we’ve got our instructions in here we’ve also got a read me if uh you want to uh see more info on here right so we can c the read me Okay, then. So, uh, yeah. All right. Uh, so let’s go to here. So, here we’ve, uh, filled our disk, right? So, same thing. Uh, we can check, hey, what’s going on
[22:46] as far as what’s taking up our, uh, our disc. All right. All right. And then we just got to figure out, hey, what is the path uh in here that’s taking up all of our uh this, right? Actually, this used to have all of our instructions in here, but right, we can
[23:17] see in here. Uh let’s remove this guy. Okay. And again now I should say that we’ve succeeded. We also have a Oh, we were supposed to put it here.
[23:47] Just kidding. All right. So, the easy levels apparently
[24:18] were not as simple. So in theory, well, what we can do is we can actually just reload this uh s I broke the demo. That’s okay. We can just start a new one. Let’s try again. And let’s pretend I didn’t break that. Okay.
[24:51] Okay, we should have just been able to delete it. But let’s do it here then. Okay, there we go. So, okay. All right. All right. And then so we were then we get the uh we were supposed to paste the uh path in there instead of remove it. I guess I broke that. Um and so everyone able to get to this uh flag
[25:24] or cool. All right. Great. Anyone not able to get to this flag? Okay. So uh real quick for how I solve that one. Uh what you do is so uh on the disk fill uh challenge what we’re looking for is uh which uh what is taking up all of our file uh space. Uh and so what we need to do is we need to find uh up here in the hints uh you can copy the uh the uh
[25:54] script uh to find where uh what’s taking up all of our uh disk space. And then here we should be able to see that we have this slashtemp selfone discill.bin. Um and then what we can do is just paste it uh down here into the path uh checker. All right. And then click uh here to clean it up. And that’ll run the delete command for us. And then uh we should get this uh task uh complete flag. Everyone got there?
[26:25] >> So >> I don’t get this. >> You don’t get this. path. >> Disk fill path. >> Okay, one second. So, you’ve gotten to uh disf level level four. >> Cool. Third time’s the charm. All right. So, we can open uh the page for the challenge. Uh and then so what we want to do is so
[26:56] up here we have uh some code that we can run in order to find uh what the uh what what files uh are taking up the most disk. Okay. So are we able to get to here so far? Cool. Right. Then uh when we run this uh dua uh we should be able to find the temp file the file in temp uh this uh disk fill.bin uh that’s taking up 512 megs of uh disk space.
[27:31] You don’t have that. >> What do you have? >> Sorry. >> There’s nothing inside of there. All right. So, what we can do, right, and that’s where uh the great thing about sandboxes, you can restart them. Uh right. So, if you go back into here, when you uh click on the start sandbox, uh we can reload the snapshot by clicking on this reload button up here, right? And so, this will spawn us a new copy of it.
[28:09] >> Okay, everyone else good? >> Yep. >> Yeah, exactly. So, it’s this button here. Refreshes it. And then you can see here it’s saying hey uh start here open this browser page uh for this uh set of uh tutorials. Um it’ll say we’ve returned uh if it’s the same one >> and that resets like original >> exactly. Yep. And so that’s where uh yeah it’s it’s you can see like our start time is pretty fast right clicking
[28:41] here able to create a sandbox and relatively quickly. Uh and so it’s we can create as many sandboxes as we want to create. >> Question. >> Yeah. >> You don’t have any funny characters that have some supporting agent go and scrape this or things like that. We won’t have any issues. >> Nope. Yeah. I mean, yeah. Uh this is just a terminal showing the sandbox. Most of the time when people interact with this, it’s all programmatic. So you have a web server that’s going in programmatically and running code in the sandbox purely for demonstration purposes. Uh, and also for debugging
[29:12] purposes, uh, being able to quickly go into the browser and pull up a sandbox can be useful. Um, and also here it’s kind of we’re able to spin up a web page really quickly to get in and see what’s going on. >> Yes. Yes. Yes. And that’s what I was saying. So, uh, yeah. Um, we’ll come to that in a couple levels where we actually start uh interacting uh programmatically with uh these sandboxes. But mostly it’s right now we just want to make sure everyone’s on the same page for what is CPU, what is RAM, uh what’s going to blow up uh
[29:42] when we’re starting to run a whole bunch of different uh things that we’re getting arbitrary code execution run on. Cool. Everyone good now? Awesome. All right. Um one thing I didn’t do was get the code for that level. I’m just going to go uh restart him real quick. I’m just clicking around on buttons.
[30:20] Let me find our pro our uh file that’s taking up all of our disk. this guy here. And then we can check our path. Okay. And we’ll click on clean up. Great. All right. And so that’s the end of our easy uh easy tasks. All right. How’s everyone feeling? We we know all about how to mess around with Linux now. Feel comfortable? Yes. No. Great. Uh let’s stand up for like a
[30:52] minute real quick. Uh get the blood flowing. uh kind of stretch out. Okay. We’re also a calisthenics uh company. Okay. Cool. All right. So, that was hey, this is what Linux is. Uh our next set of uh uh tutorials are going to get us into actually looking at the sandbox life cycle. Uh so with a normal server, you
[31:22] spin up the server and it lasts there until you’re like, “Hey, I want to shut it down.” Or Amazon is like, “You haven’t paid your bill in a while. We’re shutting it down for you.” Uh or actually, if they’re doing anyway, TLDDR, uh for sandboxes, a lot of what you’re doing is looking around the life cycle of the sandbox. Uh there’s multiple things that we need to care about here. So one is let’s say you’ve got thousands of users or tens of thousands of users. You’re like, I want to give every single one of these guys a sandbox when they come to my application. Well, how long should that sandbox last? Right? A lot, you know, intuitively it’s like, hey, I’ll give
[31:52] them the sandbox. They land on my web page. I’ll give them the sandbox for 20 minutes. If they don’t use it, I’ll shut it down. But if you got thousands of users and they’re only going to use it once or maybe not even interact interact with the sandbox, you’re wasting a whole lot of resources spinning up sandboxes that no one’s ever going to use. Uh, and so that’s where, but maybe it’s like you’ve got people that are going to come in and bounce, right? They’ll come in, try it for a second, be like, “Hey, does this thing work?” And then bounce. Uh, in that case, what you want to be able to do is you want to be able to have the sandbox there, have it be able to run their initial command, and then have it go away once, uh, you know, once they’ve
[32:24] done the command and maybe, you know, they’ll come back again 10 minutes or so. Uh, you want to have that sandbox come back once they’re there. Uh, so that’s where for the sandbox life cycle, um, you need to make sure that you’re basically using as little sandboxes uh, as you can at a time. However, you know, let’s say you’ve got people that are running long long run processes, right? All right. So, let’s say you’re doing data science, web scraping, whatever. Uh you don’t know how long uh the user’s tasks are going to run, right? So, maybe you’ve got the users coming in, they’re running a task that takes 10, 15 minutes, uh and
[32:56] then they’re doing whatever, right? So, it’s how do you get that trade-off uh between how long you keep the sandboxes sitting around uh versus not eating money into the sun. So with this task, what we’re going to do uh is we’re going to take an approach uh to our sandbox management where what we’re going to do is we’re going to give sandboxes a really long time uh to live, right? We’re going to say, “Hey, when a user comes in and runs a command, we want that sandbox to run for as you know, as long as we want it to, but once the sandbox finishes its task, we’re going to give it a very short timeout. So
[33:27] it’ll stick around in case they give it, you know, another command, but then it’ll shut itself down. And then that way we can free up those resources to spin up another sandbox for somebody else. So, we’re going to go ahead open this up, right? Uh, this one, uh, there’s no code involved, right? And so, all we’re going to have to do here is think about, hey, when we’ve got these, uh, people coming in, uh, running, uh, commands, how long should things, uh, uh, the state machine, uh, for how long should this run, right? Uh, so you can read up here, right? This thing can take a long time.
[33:58] Uh let’s say we’ve got a task and we think uh the initial task uh we should have the instructions on here somewhere. We’ve got a policy. But basically what we want to do is we want to uh allow this task along as long as as long as it wants to. But afterwards we want to shut it off after a minute. So what we’ll do is we’ll say hey we want this command to be able to run for an hour. Okay. So we set our command to run for an hour. We can then run our task. Okay. And this is all simulated because we’re not going to
[34:29] have you guys actually wait an hour for a task to run in a sandbox. Uh, and what we’ll do afterwards is we’ll say, “Hey, I want the sandbox to only uh stick around for a minute. Uh, and then it should shut down afterwards.” All right, very simple. What I just did there uh because we’re cheating, but uh that’s basically uh what the goal is here is thinking about when we’ve got a a sandbox that we’re just going to have it uh do a task. Uh we wanted to stay uh around as long as the task is going to take. Uh but then afterwards once we get that result back we can be like hey have
[35:00] it go away later. Cool. So everyone able to get to this flag or is that um did I spin that uh go through that too quick? Up. Thumbs up. Okay. I see a lot of thumbs up. Great. All right. And then if you want to cheat uh you can just put in the code here. So, it’s right size runtime lifetime. Uh, let me zoom in on that for you guys.
[35:30] All right. Uh, so we can come around or uh would it help if I went through that again real quick for anybody here just to show how that worked. Okay, I’ll go through it one more time. All right. So, I’ll just spin off this uh that task again. >> Yeah. that just like you say >> exactly >> or let’s say the user has like um they’re having to read a large file or they want to do video processing, right? That can you don’t know how long that’s going to take. Uh and so what you want
[36:02] to do is you want to give the sandbox a long life cycle uh so it can complete that task. Uh but then after it finishes the task, you don’t want to keep it sitting around using resources. Uh so you give it a shorter timeout afterwards to be like hey unless the user starts interacting with this shut pause it shut it down put it into so you can resume it later >> if it’s like a web server >> right >> exactly well cloud session is similar right so with a cloud session >> yeah speed matters right and so it’s all
[36:34] these things uh you end up dealing with like a speed versus cost trade-off um where if a sandbox is running things are fast uh if it’s paused, it’s cheap because you can have as many of them, you know, you can have lots of them paused and not be paying for them or, you know, if you’re CPU limited, you just you can’t run that many sandboxes at a time. Um, but like for something like cloud, you don’t know when the AI is going to come back to reuse that sandbox, right? Maybe it’s using 20 sandboxes, right? And it uses the sandbox and it’s going to So, uh, that’s where it’s Yeah. you
[37:06] end up having to do your sandbox. >> Yeah. Okay. So, if if if you’re talking demons where it’s like you want something that’s persistent and long running, sandbox may not be the best thing to do there. Uh you can, right? You can definitely have a sandbox that you’re like run it for a day, right? Uh but there’s probably cheaper uh or more kind of traditional methods to do that, but again, we’re running all this stuff inside of a sandbox right now inside of multiple sandboxes. So, you can definitely run web servers inside of them. Um but they’re just not gonna be optimized like as far as CDNs and that.
[37:37] Yeah. Um >> can you use this in your main development? >> Yeah. >> Sandbox you keep adding it other folks get some replic. >> Yeah. So how to uh fork things. Exactly. But that’s kind of where a lot of people are using these things is that you can give the AI sandbox say, “Hey, let’s install the base dependencies like you would with your GitHub actions.” So you’ve got kind of a basic cache thing and then you can pull it in and then
[38:08] build on top of it, right? And then that way if you’re doing like work trees, right, you’ve got a single one. Each work tree has Yeah. >> Yep. Okay. So anyway, so for here, uh, go back to our life cycle, right? Real quick, what we want to do is basically we want to give it a really long runtime, right? All right. So, here we’re going to give it an hour and then but once it once it finishes the command, we want to spin the uh the uh spin the timeout back down to a minute. And so, what we’re going to do
[38:39] is we’re going to set our command timeout. We’re going to run a fake task. Uh and then we’re going to set our uh Whoops. Set our lifetime back to something very uh short. Okay. And then that should give us, hey, we’ve solved this uh challenge. Cool. Yay. Complete. All right. Uh not so. And then this gets us into uh our next uh lab, which is our
[39:10] background process leaks, right? So uh definitely when you’re coming back and reusing the same sandbox over and over again, uh you’re going to run on uh run into orphans, right? So basically you start a process uh and then you go and do something else you come back to your machine if that machine is still running right you you end up accumulating a whole bunch of different processes running over time uh and that can kill performance of the sandbox. Uh for some reason with sandboxes we see this a lot. Um but it kind of makes sense because like you’re pausing your process and coming back to it rather than getting
[39:40] like a new image every single time. Uh so it’s the advantage of right resuming this old state. things are fast, things are where you left them. Downside is things are where they left them and you if you haven’t cleaned up after yourself. So a lot of times what you have to do is you’ll have to come in and try to figure out how do I uh kill my orphans. Actually I think a lot of sandbox management ends up being killing orphans. Uh you end up with uh a lot of the time also is uh related to this is uh when you start up sandboxes you need
[40:11] to keep track of them. Uh, and if you lose track of your sandboxes, uh, you need to figure out how do I go find the sandboxes that or or that I’m not managing anymore, uh, and make sure that I remove those resources. Um, so here is a demo of how to go, uh, find our orphans, right? And so, uh, we have our code here, uh, that we can, uh, in this nifty terminal, uh, we can go ahead and, uh, we can run some code to figure out how many orphans we have, right? Right. So, right here we can see we hop into the sandbox and we’ve got uh three
[40:42] orphans uh uh that are alive, right? So, we’ve got three children, right? And then if we uh search for them, what we can do is uh often your uh processes that you orphaned are going to be the same. Uh here uh we’re able to grip for them by this nifty uh somehow they’re called orphan worker. Uh in real world, unfortunately, they’re not normally named this. Um, but uh for simplicity sake uh here we’re going to be able to easily find them by just looking for orphans. And so all we
[41:13] need to do now is kill our uh leaked children. Okay. And actually while I’m doing this uh so how many people here have run into orphan problems on their just regular servers as far as having a bunch of processes running? Yep. Okay. These guys over here. Right. It’s like a very common problem that you’re going to run into. Um but uh so right, we’re going to kill 448. Uh then we can run our script again, see
[41:44] how many orphans we have. Now we know there’s two running. All right. So we still got our two orphans. And we’re going to kill 449 and 50. All right. And now this should notice. There we go. Once we’ve uh gotten rid of all our orphan processes, uh the web page should notice uh that they’re no longer there and give us the code to get to the next level. Cool. So, everyone able to clean up their box and uh get this code. Cool. Anyone having a hard time finding the processes that are running around
[42:14] and uh hasn’t been able to get them yet? Great. So, we will take the slag and drop it into here. Okay. Uh so uh next thing for sandbox management that we want to uh cover real quick is uh our uh workspaces. All right. So when you first start dealing with sandboxes uh one of the first things that you do is like hey I’ve got all these servers I will just
[42:45] hand them out to users. Uh here we’re kind of coming into we’ve done this at naive approach to sandbox management that we’re just roundroining the sandboxes. So rather than uh keeping track of what user gets what sandbox uh we’re just you know you come in you get a sandbox and then uh right and so what we want to do here is this is the first uh code exercise uh is we’re going to want to go look at our Python code that’s on uh so we have a little basically uh handler inside of here uh and we’re going to want to modify it. So instead of giving us a roundroin uh sandbox assignment we’re going to keep track by user of what sandbox they get.
[43:17] Um, we didn’t want to blow up our servers uh with spawning a ton of set boxes that we don’t need. So, we have a bunch of mocks uh that are going to let us uh test what happens uh with our management. And so, if we open up this uh terminal, we can go into our uh router.py or router.js. I think most of us know Python, so we’re going to go with the Python today. All right. Um, we have a read me in here as well, but we’re running out of time.
[43:47] So, um, actually, let’s see if I have instructions on this page, too. Yeah. So, basically, it’s right now we’ve got a a code that runs around Robin. We want to change our code. So, instead of being around Robin, we’re going to assign this to users. Uh, the way that you do it normally is you’ll have a database keeping track of, hey, here’s all my users. Here, here’s all the active sandboxes for each of the users. Uh, keeping this persistent generally is useful. Uh so that way you can go back historic over historic data and figure out like were we reassigning too many sandboxes to users or what was going on. Um but for here uh we’re just going to
[44:19] have this assignment dictionary. And so all we’re going to need to do is we’ve got this assign sandbox function down here. And so right now it’s just assigning it. And so what we’re going to do is we’re just going to quick modify this. Right. So we’ve got that nifty assignments. Oh, okay. 15 minutes left. So, check if we’ve already kept track of this guy in our assignments. Also, very hard to uh type on a screen that’s way down there. Uh, and we’re
[44:51] going to return assignments of [snorts] user ID. We’ve already got this function here that’s going to get us the sandbox ID from a sandbox. So, we’ll say sandbox ID equals that thing. All right. And basically, we’re just following this. Uh, you should have instructions. Oh, we don’t have instructions. All right. So, we’re going to cheat. So, uh, uh, if anyone is, has anyone already gotten past this level? Okay. So, a
[45:21] couple of us have already gotten past this level. Uh, so it is solvable in the time that we had here. Uh, but so all we’re going to do is we’re going to assign uh, the sandbox ID here and we’ll return the sandbox ID. Right? So what this is going to do is now assignments is going to be our cache of hey this is the ID that each user gets assigned uh and then we’ll return that otherwise we’ll have to create new sandboxes for everybody uh and return that sandbox ID. Okay. Uh okay great question. All right so basically what we
[45:52] want to do is all we need uh the point of this is just saying we want to keep track of what user had what sandbox. So you’re creating a map of user to sandbox ID. Right? That’s that’s that’s the only point. Uh so kind of starting with, hey, we’re not keeping track of any of our sandboxes. So now it’s like, hey, each user is going to have a dedicated sandbox so they can rerun code uh in the same sandbox every time. Okay. And then we should have some tests in here
[46:26] uh that we can run. And hopefully uh y’all are better coders than me. Uh, line 2. What did I mess up? All right, it’ll run the test real quick. And I’m going to fail my tests.
[46:58] It’s not false is not true. Uh, one second. >> Sorry. >> Oh, good point. Exactly. See, that was a test of the audience and good job. You passed. So, right, we need to add it to the assignments.
[47:32] And so now that uh we’re actually adding our sandbox ID to the assignments, uh we should then um pass. Great. And now that we passed, we should pick up over here that we have passed or come on.
[48:02] All right. So, remember how I told you about how we learned about the uh uh we learned about the uh orphans? Well, we have quite a few orphans running now. Okay, there we go. So, took a minute, but this let’s just get to the next lag. Uh, right. Cool. Everyone able to get that? Cool. And we’ll post that here.
[48:35] All right. Uh, file system permissions. All right. So, uh I I think both cloud code and codeex have this is that a lot of times you don’t want your agents writing to every single part of your file system. You’re going to have different parts of your file system uh that you want people writing to and reading to. Um normally this will go into your agents.mmd saying, “Hey, this is what I want you to write to, what I uh want you to read to.” Uh for these purposes, we’re just going to hardcode this. But same thing uh right so you’re going to have uh often you want to have read
[49:06] uh write parts of your file system. So here let’s take a look uh so uh we’ve got a cache config and so uh v cache. All right and then we can do the same thing. So here uh basically we’ve got a template cache and a runtime cache. Uh so this is where when we build our templates, we’re going to have a cache that we’re putting our template uh information to that might be uh readon.
[49:37] We’ve got a different cache that we want to uh write to. So all we’re going to do is for our crasher, we’re going to have uh refer to this uh cashier which we’re going to spell correctly. And uh there we go. Cool. So, that was a very fast one where all we’re doing is making sure that we’re uh writing to our uh runtime cache. All right. Uh at this point, let’s see. I think you all can do the rest of this
[50:08] on your own. We’ve got about 10 minutes left uh to talk about sandboxes. Um so, yeah. Uh hopefully that was a good introduction to hear uh issues that you’re going to run into with your sandboxes as far as managing uh what’s able to do what, what’s able to read to what. Uh, we’ve got about eight more levels. Um, actually, I’ll leave this to you guys. Do you think it’d be helpful to continue walking through all these or more fun to just talk about sandboxes? >> All right, let’s talk about sandboxes. Great. Um,
[50:40] let’s see. Uh, so who here who here is currently running sandboxes in production? Oh, wow. Those guys back there are running sandboxes. Anyone else here running sandboxes? Those guys over there. Uh, what are you guys doing with sandboxes? agent works. >> Agent workloads. Cool. Do you need to be >> Oh, okay. You know, no one’s perfect. >> Not yet. >> Okay. Uh we’ve Travis is over there. You should go talk to him. Uh and then what do you do?
[51:10] >> Okay, cool. Woohoo. He a great. Um yeah. Yeah. So, any of the uh issues that we just covered, have you run into any of those? >> Uh not yet. Oh, okay. Gotcha. Yeah. Yeah. And so we are uh part of what we do is we try to make it so you don’t run into issues. Um but your user you’re always going to run into something where it’s uh something is happening on the sandbox. You need to hop in debug it and figure out why is this thing breaking. Um great. And then we had some guys doing sandboxes over here. Yeah. >> So I have a slightly different use case.
[51:41] >> Yeah. >> Okay. So sorry. Uh just so everyone else can hear. So you’ve got your vanilla production on your on your laptop. Okay. >> Then I want to spread it across on several GPUs which are like small what you call small GPUs. >> Okay. >> Collect the data back. >> Okay. Processes over here and they are across what you call networks different providers. Yep. So basically you’re saying you you’ve
[52:12] got your code local local you want to put it onto a bunch of distributed GPUs process the uh the workload and then send it all back to to local okay >> I want back >> yeah so you want the data back yep >> yeah so right now we don’t support GPUs but that’s of course a common use case that you can you know when you’re spinning up these contain uh whatever they are so for us we use VMs a lot of people also use containers uh common use case is you’ll be like hey uh take the output of whatever’s running into and send a post request home with the data that I want it to uh to have. Uh that’s
[52:46] like all these depending on how how big the workload are, uh you’re going to have different bottlenecks and challenges. Um where we’ve had, you know, it’s one of the weirdest things about sandboxes, right, is that uh when you’re just running a couple, you’ve got certain problems that are like, hey, why is this behavior, you know, why is one or two sandboxes breaking? Once you’re dealing with a lot of sandboxes, uh then your problems become how do I manage all, you know, just just the logging overhead of how do I keep track of these? How do I make sure that I’m assigning all these um uh keep track of
[53:18] the network for the machines that it’s running on, right? So each machine can only be talking to so many sandboxes at a time. But uh yeah, definitely if you’re running on GPUs, EDB doesn’t do GPUs. Um and I guess so yeah that’s where the sandbox solution might not be although why would you need sandboxes for that as opposed to just having the GPU >> because I can get it at any place at whatever cost. >> Gotcha. >> I want
[53:52] it. >> Makes sense. Yeah. And that’s that’s a common use case. Uh, I just don’t know enough about that, I guess, to give a good answer. Cool. Uh, and then we had someone else over here using sandboxes. Okay. >> Something Kubernetes. >> Cloud and Kubernetes.
[54:24] >> Yes. So, okay. So one of his questions is how do you deal with the storage over time right so how do you prune uh the resources that you you develop so one of the problems with sandboxes is uh you can create lots of them but then it’s where do you store them uh that’s an active challenge that we’re currently working on if you if that interests you we are hiring um uh and again uh if if you do go uh we’re uh hiring go engineers so our backends go uh a lot of really fun challenges there how do we uh optimize speed uh performance and then especially on storage uh how do you deal
[54:56] with the compression uh and uh uh that sort of challenge. uh >> volumes >> that sorry >> volumes >> volumes right oh yes we also have volumes um and so that’s where if you have shared resources that multiple things can share uh volumes are great for that um but yeah it’s I think all this is very early and nobody knows where it’s going to go uh so as the smart pe you smart people in this room are going to come up with better solutions uh that optimize things uh don’t know if that’s a good answer uh but yeah so for your question on cloud right so it’s you can run cloud in
[55:27] sandboxes pretty easy Um uh where where’d we go? So it need to be right. So the same way that we uh spun up these guys, we can just be like template equals I think claude should spin us up a cloud code. I’m guessing at what things do. Okay. Yeah, I think we have claude on here, right? So yeah, you can run cloud in a sandbox. Um right, you can run open code, right? Uh codec in a sandbox. Uh basically these give us places where you can have agents run remotely or locally
[55:58] you can have the agent talk to it. Um and uh you get the same thing. But yeah as far as cube uh so we are firecracker uh based um and so we’re trying there’s some technical issues uh with cube uh that we have that we haven’t quite solved. Uh so right now we’re uh running Nomad uh but working on getting uh into cube. Yeah. >> Cool. across sandboxes.
[56:30] >> Yes. Yeah. Yeah. So that’s definitely common. Uh definitely doable. Uh we didn’t do that for this exercise. Uh so what we kind of did for this where you were the coordinator, right? So basically the sandbox uh you clicked on a thing and said, “Hey, start a new sandbox uh from this template.” uh that wasn’t automated in this case because I didn’t want to deal with uh making everyone grab their API keys. Uh I also didn’t trust myself to this is being recorded uh and to not expose my own API keys by putting them up on the screen. Yeah. Um but yeah, definitely that’s
[57:02] kind of cool that you can get that inception that you have a sandbox and then it spawns more things. >> Cool. Uh we got time for two more. Yeah. >> So what’s the ecosystem of these sandboxes like after the all of these do you see that like a docker ecosystem of sandboxes are everywhere. >> Yeah. So the question is what’s the ecosystem of sandboxes? Uh is it going to be like docker? Uh and I mean all this is early right so like these AI agents are what like two years old LLM
[57:33] as a service 5 years old. Um nobody knows what the ecosystem is going to look like but definitely as people build cool things uh we tend to standardize around them share how to do it. Uh and then that leads to uh yeah so and that’s where our templates come in right where again you know here I had a template and 200 of you guys were able to then reuse that same sandbox uh without too much of a uh yeah so we’re going that direction but time will tell yes
[58:09] >> we actually okay so internally a to b uh we’re running I Yes, we run locally especially for testing, right? Um because uh running in the cloud is just a pain. But as far as like uh and so yeah, actually we’re doing a lot of local uh uh development. >> Yeah. So I mean that’s where so our sandboxes have different rules that you can set for the uh network. Uh
[58:40] that’s where if you give it access to secrets, you defin want to uh prevent what it’s going to be able to send out. Uh if it doesn’t have secrets or just got dev keys maybe. And so that’s right. It’s the ease versus uh security. Cool. Anybody else? Going once, going twice. Anyway, hope you all had fun. Uh the you can go ahead and complete this uh these challenges on your own. Uh thanks for coming and again I’m Matt with E2B and uh it was a pleasure meeting you all. >> [applause]
[59:30] [music]