{
  "video_id": "eSP7PLTXNy8",
  "channel_slug": "claude",
  "channel_handle": "Claude",
  "title": "Build a proactive agent workflow with Claude Code",
  "duration_seconds": 1323,
  "url": "https://www.youtube.com/watch?v=eSP7PLTXNy8",
  "upload_date": "20260520",
  "transcript": "Hello everyone. How are you?\nGood. Okay. Amazing. Welcome to the last\nworkshop session of the day. I hope you\nhave all enjoyed the very first day of\ncode with Claude. Uh my name is Maya.\nI'm a member of our applied AI team here\nat Enthropic. Uh what that means is I\nspend about half my time developing our\nown firstparty products and features and\nthe other half of my time helping\ncustomers develop their very own\nproducts, features, agents on top of our\nmodels.\nToday I'm here to talk to you about how\nto build a proactive agent workflow with\ncloud code. Um, can I get a show of\nhands? Who has used our routines feature\ninside of Cloud Code? All right, some\nfolks over here. Awesome. Awesome. Um,\nthat's what I'm going to be talking\nabout today. Okay, so first off, a\nquestion for the group here. Who has\ntried to run clawed code on a cron? Can\nI get a show of hands? Folks, put your\nhands up high. Awesome. Awesome. Um, now\nkeep your hands up if you've enjoyed\nbuilding all of that infra and\nmaintaining that job. All right, we have\none guy back there. We have one guy.\nThank you. Thank you for your effort.\nThank you for your work. Um, we felt\nsimilar pain internally at Anthropic as\nwe tried to develop uh proactive agents\nuh that run on cloud code. Uh, and we\ndecided to do something about it.\nSo, we believe that coding agents\nshouldn't wait for you to press enter to\nget started. Right now, Claude code is a\nreally powerful coding tool, but we want\nto take Claude code and turn it into a\nreally powerful coding teammate.\nA teammate notices when something breaks\nand does something about it. Right now,\na tool waits for you to enter your\nprompt and actually press enter.\nSo the goal of today's presentation is\nto talk about how we have created this\nfeature called routines to take clawed\ncode from a tool today um into the\nteammate of tomorrow.\nSo today we'll be talking about four\nthings. I'll go through some of the\nchallenges that you folks have felt uh\nbuilding proactive agents today. I'll go\nthrough this new feature inside of cloud\ncode called routines.\nWe'll go through a real example about\nhow we use routines internally at\nEnthropic to automate documentation\ncreation and then finally we'll talk\nabout applying routines to your own\nworkflows.\nSo\nI want to talk first through the\nchallenges with building proactive\nagents today. We all know it's doable.\nUm but I want to talk about what what's\na little bit cumbersome with this.\nThe first thing that's a little bit\ndifficult with building proactive agents\ntoday is deciding where these agents\nshould run. You probably don't want them\nrunning on your local machine because if\nyou close your laptop or your laptop\ndies, your agent session is done. What\nthat means is you'll need to manage\nthings like hosting, data persistence,\nand authentication.\nBasically, you'll need to build a whole\ninfrastruct outside of your prompts,\nwhich is doable, but it's a lot of work\nand there's a lot of boilerplate code\nthere.\nThe next thing you'll need to do is\nfigure out when to actually kick off\nthese sessions and trigger these agents.\nAgain, you can build things and build on\ntop of cron or you can do things like uh\npost to endpoints that you have to spin\nup. Um, but again, there's there's a lot\nof infra that you need to build yourself\nhere.\nFinally, the challenge with building\nproactive agents today is sometimes you\nwant to be a human in the loop, but\nother times you want to be a human out\nof the loop with these agents. Um, right\nnow when you kick off a headless clawed\ncode session, it's often hard to figure\nout what your agent is actually doing in\nreal time. There's no way to watch,\nsteer, bound, or even resume your agent\nsession. It's it's difficult to do that.\nUm, so we wanted to address each of\nthese three issues um, and build\nroutines. Routines is a brand new\nfeature inside of Cloud Code. It's an\nautomation where you can kick off a\nremote Claude code session by only\ndefining the prompt, what repos you want\nto connect it to, what connectors it has\navailable to work with, and a trigger.\nClaude Code handles the rest.\nSo there were three kind of main things\nwe were thinking about as we went ahead\nand developed this routines feature\ninside of cloud code.\nThe first thing is that we wanted these\nagents to be always available.\nThese agents these routines run on\nclaude codes managed infrastructure. And\nwhat what's nice with that is that we\ndeal with the hosting the session state\nand the connector off for you. nothing\ndepends on your laptop being opened and\nwe deal uh with all of the cloud stuff\nfor you which I think is quite nice. The\nnext thing is we want these agents to be\nable to work proactively with\ncustomizable triggers. You might want to\nkick them off on a timebased schedule or\nyou might want to work uh event based.\nuh we have the ability to work natively\nwith GitHub events as well as your own\ncustom events that you can post to um\nweb hooks and endpoints with the event\npayload as context.\nFinally, and the last point that I think\nis really nice is that these clawed code\nsessions that get get launched with\nthese routines are interactive and\nsteerable as if you were launching\nclaude code in the terminal. Every\nroutine is really just a claude code\nsession under the hood that you can\nopen, you can watch, follow up on,\nsteer, and resume um from web CLI and\ndesktop.\nAnd so I want to walk you guys through a\nreal use case that uh we use here at\nEnthropic internally. So the question\nfor us and for a member of our\nengineering team is how can we automate\ndocs creation with routines?\nSo, just to add a little bit of data\nbehind this, weekly PRs for Claude Code\nhave gone up 200% since the beginning of\nthe new year. This has been super\nawesome for our Claude Code engineering\nteam. Um, their productivity is insane.\nThis has been really awesome for you\nfolks because you get new features\ninside of Claude Code very, very\nquickly.\nThe one person that this has not been so\nawesome for is the one engineer\nresponsible for maintaining our\ndocumentation across cloud code and the\nagent SDK. And so when routines\nlaunched, she was a super big fan and\nearly adopter. And I want to walk you\nthrough how she set up a couple routines\nto help automate documentation creation\nfor cloud code and our cloud agent SDK.\nSo on my side here, I have the terminal\nopen. And I encourage you all to open\nyour terminal and launch cloud code.\nAnd inside of the terminal here, I'm\nable to type what we see on the screen\nhere, slash schedule, and actually type\nin something that Sarah, our\ndocumentation uh queen, uh has done to\nactually set up this routine. So she\nwent and typed in once a week uh please\nreview all the new changes merged to\nmain against our documentation repo and\ncreate a PR to update docs if you see\nany changes.\nI encourage you folks to think right now\nwhat are some tasks that you do every\nday that would help if they could run on\na schedule or if cla could actually\ninitiate these sessions for you. Um I\nencourage you to think about that.\nAfter kicking this off inside of Claude\ncode, Claude comes back and prompts me\nwith a couple questions. It might ask,\n\"Hey Maya, at what time every week do\nyou want me to actually kick this off?\"\nOr once I create a PR, do you want me to\nnotify you in any way? Maybe ping you on\nSlack. And once I answer these\nquestions, Claude actually goes ahead\nand creates a routine um that we'll view\nin a little bit inside of Claude Code on\nthe web.\nBut first, I want to walk through the\nthree main decisions you'll need to make\nas you create any routine. The first\ndecision is you'll need to figure out\nwhen your routine should trigger.\nWhat's actually the event or is there a\ncertain cadence that you want this to\nrun?\nThe second decision is what context or\nwhat information does Claude need to\nhave to actually be successful here? Do\nyou need access to certain docs or does\nClaude need access to certain tools to\nping you?\nFinally, the last thing to think about\nis how do you actually steer Claude in\nthe session to keep it honest? How do\nyou guide claude to the output that you\nwant? And so we'll dive into each one of\nthese and I'll talk through how Sarah, a\nmember uh of our team, actually does\nthis to automate documentation creation.\nSo the first one is the trigger. When uh\nshould this event actually run? So\ninside of routines, there's basically\ntwo ways to do this. You can have things\nkick off on a schedule on a timebased\ntrigger.\nFor that earlier example I showed you,\nuh this is how we do a weekly review of\ndifferences between our source code for\ncloud code as well as our documentation\nrepo.\nYou can also have routines kick off uh\non an event-based cadence. So maybe\nevery time a release is cut, uh you can\ndiff the release branch against the docs\nand see if there's any new features that\nyou'll need to spin up PRs for in our\ndocumentation repo.\nOr maybe your engineer is actually\ndeploying uh changes and creating PRs\nmight tag their changes. Maybe this is\nlike a new feature. They could tag it\nwith a label that says need docs. And\nyou could actually kick off clawed code\nsessions anytime one of these uh labeled\nPRs get merged.\nThe next thing you'll need to think\nabout is context.\nWhat does your agent actually need to\nknow to be successful?\nLikely you'll need to give it access to\neither one or more codebase repos. So\nfor this docs example, uh we need to\ngive Claude access to not only our\nclaude code source code to figure out\nwhat new changes exist there, but also\nour docs repo, right? For claude to\nactually create uh new PRs there.\nNext, you might want to provide\nadditional context to these sessions. Uh\nmaybe for this one example, I want\nClaude to have access to all of our\nexisting marketing briefs. Maybe I want\nClaude to use similar language and\nverbiage that we use uh in other\nmarketing materials externally at\nEnthropic. So maybe all of this lives\ninside of Google Drive and I'll want to\ngive Claude access to these files during\nthe session. So I'll hook up the drive\nconnector.\nOr maybe anytime Claude creates a PR, um\nI'll actually want it to ping me on\nSlack. Uh so I'll give it access to the\nSlack connector. It's important to think\nabout this as you're setting up the\nroutine because whatever context Claude\nhas, that's uh the ceiling of how\nsuccessful Claude will be.\nFinally, the last thing to think about\nhere is steerability.\nHow do we actually ensure the quality um\nof Claude's outputs?\nThere are a couple ways to do this. Um,\none thing that I think is quite\ninteresting is to actually invest in\nagent onagent review. If folks have\nactually designed multi- aent systems\nhere and have heard of the generator uh\ncritique pattern, uh this is something\nthat we've borrowed here. You can\nactually set up one routine to go ahead\nand create uh docs PRs and you can set\nup another routine that maybe triggers\non that PR's creation um to actually go\nahead and leave comments on the PR\nbefore a human actually gets to it.\nAnother option we had emphasized it's\nnice to have a human out of the loop,\nbut sometimes you actually do need to\nmonitor these cloud code sessions and\nmaybe nudge Claude in a different\ndirection. What's really nice and what\nI'll show you in a second is that you\ncan actually open Claude Code on the web\nand you can view what's happening inside\nof a live session as if you would\nworking with Claude in the terminal. You\ncan ask it questions midsession. You can\npush it in another another direction.\nYou you can also resume a past routine\nor a past session and continue the\nconversation.\nFinally, the last thing we do and what I\nthink is quite obvious is that we verify\nClaude's outputs. For this documentation\nexample, we actually render the page\nthat or the documentation page that\nClaude has changed and created and we\nconfirm those outputs are what we\nexpect.\nAnd so now I'll jump back into that\ninitial routine that we've kicked off\nhere in this demo. Um, and we'll jump to\nthe demo slides. Awesome. And so we can\nsee right now I'm in cloud.ai AI and I\ncan go over to this left side panel and\nactually kick click on this uh code\nbutton\nand I can jump into routines on this\nleft hand side and I can actually click\non this routine that I had created\nearlier.\nOn the left hand side here you can see\nthat it's connected to two repositories.\nour uh mocked up Cloud Code source code\nas well as our Cloud Code documentation.\nYou can see that this runs every Monday\nat 10 a.m. and it's connected to GitHub\nas well as Slack.\nThese instructions here on the right\nhand side Claude generated for me based\non the initial prompt that I pasted in\nand the questions that I answered. We\ncan see here that uh this is a a weekly\ndocumentation sync uh for our claude\ncode fork.\nAnd I can actually go ahead and click on\na session here. And I can see that these\ninitial instructions are what uh gets\npasted in for the very beginning of this\nClaude code session.\nWe can see that Claude has read these\ninstructions and started by looking at\nthe source code repository to see uh any\nchanges, any recent PRs that have been\nmerged. Looked at our change log and\ncompared that to what's inside of the\ndocumentation repo.\nWe can see Claude's actually found some\nchanges here and gone ahead and opened a\nPR for me.\nThis is one example where you can kick\noff a routine on a schedule.\nNow I want to show you another example\nwhere we can actually kick off a routine\nuh based on a GitHub event. So here I've\nactually created a new routine and I've\nalready filled some of this in. Um I\nwant to make uh another documentation\nautomation uh routine and but this time\nI want this to actually trigger every\ntime I create a new GitHub issue.\nSo I pasted in some instructions here\nbasically to investigate the issue that\nthis session triggers on. Figure out if\nit's related to a documentation gap and\nthen if it is and if you believe that\nthis is a gap um go ahead open a PR and\nactually ping me in this channel. So\nI've gone ahead and connected our cloud\ncode documentation repo as well as our\nsource code again. And I want to show\nyou how I actually set up this trigger.\nLike I had mentioned before, there's two\ndifferent types of triggers. Um,\nschedulebased and event based. And\nwithin event-based triggers, we have\nnative git github events supported here\nas well as the ability to trigger from\nyour own code by sending a post request.\nSo here I'll create a uh GitHub event\ntrigger and trigger on issue opens\nanytime I open an issue inside of this\ncloud code documentation repo. And I\nwant this connected to Slack so I can\nsend me a ping anytime I make a PR um as\nwell as our GitHub MCP.\nSo I will go ahead and create this here.\nAnd now let's make sure that this is\nworking. So I have a new issue open here\nthat I'm about to create inside of our\nCloud Code Docs repo. Um so I happen to\nknow that there are a few few tools\nmissing from docs in this new version.\nSo I'm going to go ahead and actually\ncreate this\nSo I can see here that I've gone ahead\nand created that. And now let's refresh\nthis page.\nAnd we can see actually that a new run\nhas gotten picked up here. We can see\nthat these initial instructions are the\nvery first prompt. Um and we can see\nthat this additional context from this\nissuer passed in as well.\nI happen to know that I actually already\nhave another PR open for this. So, let\nme just guide Claude to stop this\nsession.\nI've already made these changes\nand we can see here the ability to\nactually steer Claude in real time after\nroutine gets kicked off.\nAwesome. Um, now let's come back and\ntalk about the different ways uh that we\ncan use routines to actually automate\nyour challenges. As uh developers, I\nwant to talk through um a couple ways\nthat we could turn common software\nengineering or developer challenges into\nroutines with quad code.\nThe first one I want to talk through is\nthis deploy verifier. Um maybe you have\nrecently uh just deployed changes to an\nto a service and you want to make sure\nthat this service is healthy and you\nshouldn't roll back these changes.\nI want to think about this uh in three\nways. First, what should my trigger be\nhere? Second, what context is important\nto provide to Claude in this routine?\nAnd lastly, how do I plan to actually\ninteract or steer this routine to keep\nClaude honest?\nI happen to know that my CD pipeline can\npost after every deploy. So, this seems\nlike a pretty good trigger to actually\nkick off this routine on. I can actually\npost to this uh web hook that we support\ninside of routines. And this can\nactually kick off my Claude code\nsession.\nIn terms of what context I think is\nimportant to provide Claude here, I can\nthink of a couple things. one, it's\nprobably nice to give Claude access to\nthe source code for the service that we\nreach recently deployed on.\nNext, it's probably important to give\nClaude access to monitoring tools. Maybe\nthat's data dog, maybe that's Graphana,\nI don't know what you folks use, but um\nlikely helpful to give Claude access to\nthese uh monitoring tools. And maybe if\nsomething goes down, I want Claude to\nalert me. I want Claude to ping me on\nSlack or send me an email um or maybe\nmaybe even send me a text using Twilio\nor something like that. These are some\nof the connectors or the tools that I\nwould give Claude access to inside of\nthis session.\nIn terms of keeping Claude honest or\nactually steering my session, maybe I'd\nstart by having Claude run an\ninvestigation for me and giving me an\neventual no go or no-go decision to\nactually roll back this change. I could\njump into Claude code on the web and\nactually view and read Claude's analysis\nfor this session. Then maybe I can\ncontinue to work with Claude if I\nactually think that this should be\nrolled back and actually use Claude to\nhelp me roll back a change.\nMaybe eventually as I watch Claude work\nmore and more and trust its decisions, I\ncan let Claude roll back the change\nitself if based on the monitoring\nmonitoring uh data it has access to. Uh\nif I deem that that's the right\ndecision.\nThere are other challenges like maybe\nyou want to build an on call\ninvestigator or maybe you're actually a\nPM and your job is to go through uh a\nlot a lot of issues inside of your\nbacklog. Maybe that's GitHub issues.\nMaybe that's posts inside of a Slack\nchannel and maybe you want to kick off a\nweekly job that actually reads through\nall of these issues. Um maybe it's\nkicked off on a timebased trigger. You\ngive it access to GitHub and Slack and\nwherever your issues live. Um, and you\nuse Claude to actually help you\nprioritize and maybe open PRs for the\nmost important issues. Okay, my final\ntakeaways here, uh, proactive agents,\nuh, beat reactive agents. We want Claw\nto go from a tool to a teammate. Um, you\ncan move from an agent that is waiting\nfor you to actually press enter and\ncreate a PR to an agent that reacts to\nproblems um, and opens a PR itself.\nWe built routines so you don't have to\nfocus on maintaining all of this infra,\nbut instead you can actually concentrate\non your domain and process expertise.\nThis is what routines handle for you.\nAnd finally, I encourage you to get\nstarted with routines today. Uh you're a\nsingle slashcchedule command uh inside\nof Claude Code uh away from creating\nyour very first routine.\nAwesome. Thanks so much,",
  "transcript_chars": 19266,
  "ingested_at": "2026-05-21T19:09:32.198420+00:00",
  "source": "retry-no-transcript",
  "yt_meta": {
    "view_count": 16442,
    "like_count": 337,
    "channel_id": "UCV03SRZXJEz-hchIAogeJOg"
  }
}