When you type a question in the ChatGPT, the model only has what you typed to work with.
But tools like Claude Code can plan, iterate, test, and recover from mistakes.
They work more like we do. The difference is the agent harness. Planning tools, file system access, sub-agents, and carefully crafted system prompts that turn raw LLMs into something genuinely
capable. Sydney Rinkle is back on Talk Python from LangChain to talk about their new open-source library DeepAgents, a framework for building your own DeepAgents with plain Python functions,
middleware hooks, and MCP support. This is a framework that allows you to build tools similar to Claude Code. This is Talk Python To Me, episode 543, recorded February 19th, 2026.
We started in Pyramid, cruising old-school lanes, had that stable base, yes sir.
Welcome to Talk Python To Me, the number one Python podcast for developers and data scientists.
This is your host, Michael Kennedy. I'm a PSF fellow who's been coding for over 25 years.
Let's connect on social media. You'll find me and Talk Python on Mastodon, BlueSky, and X. The social links are all in your show notes. You can find over 10 years of past episodes at talkpython.fm. And if you want to be part of the show, you can join our recording live streams.
That's right, we live stream the raw, uncut version of each episode on YouTube.
Just visit talkpython.fm/youtube to see the schedule of upcoming events. Be sure to subscribe there and press the bell so you'll get notified anytime we're recording. This episode is brought
to you by Sentry. You know Sentry for the error monitoring, but they now have logs too. And with Sentry, your logs become way more usable, interleaving into your error reports to enhance debugging and
understanding. Get started today at talkpython.fm/sentry. And it's brought to you by Temporal, durable workflows for Python. Write your workflows as normal Python code and Temporal ensures they run
reliably, even across crashes and restarts. Get started at talkpython.fm/Temporal.
Sydney, welcome back to Talk Python on me. Awesome to have you here.
Thanks. Yeah, super excited to be back.
I am super excited to have you here. We're going to be talking about almost the topic du jour, the AI, but not in the way that people might think. Not using AI to build code, although what we're
talking about could be used for that, and so on. But actually, how do you build your own AI tools?
How do you build your own cloud code equivalent if you wanted to have a lot more control over that?
So I'm really excited about it. I think it's pretty eye-opening and great tools. Last time we were on, I think we talked about LangGraph. Was that right?
Yeah, yeah, I think so.
And now, carrying on with more Lang things from LangChain, we're going to talk about Deep Agents.
So, super cool topic. I think people who feel like this is mysterious, or you sign up for some frontier model and it does all the magic. Well, we're going to dig into how that magic works and
how you might build your own as well with some really cool tools here. Now, it has been a little while since you've been on. I think you've been on three times, which is amazing. But here's number four. There's a ton of new people listening to the show or coming into the Python space in general.
I mean, it's amazing to me that 50% of the people doing Python are new to it professionally the last two years. I guess it makes sense. Anyway, quick introduction about who you are for everyone who doesn't know already.
Yeah, sure thing. Well, very excited to get to share all of our new Deep Agents stuff with folks.
My name is Sydney. I currently work at LangChain, which might sound familiar. It started as an open source package helping folks use AI. Basically, as soon as LLMs started to blow up, LangChain emerged
as a toolkit for building with LLMs in Python. And then it since has evolved into a company. So we offer
observability and evals products for agents. We basically are building a platform for folks to build agents. But we still are kind of built on our open source core, which is that LangChain project,
and now Deep Agents. And then I've also spoken with you about LangGraph. So we'll kind of talk about how all of those open source projects are related today. And then I guess I'll also note I've chatted
with you before about other open source projects like Pydantic and Pydantic AI is where I worked previously. So very excited to kind of be in the open source AI space.
It's been quite the roller coaster I think you've probably been on the last couple years.
We talked about the Young Coders Blueprint for success, right? As you were graduating college, and now you spent a good stint with Pydantic.dev, which is awesome. And that's a really,
that's a big center of the open source Python world. And so is LangChain. So very exciting, I'm sure.
Yeah, yeah. I think if I could redo the Young Coders Blueprint success now, it would probably look pretty different than it did when we chatted.
I was wondering about that as well. Maybe we'll get to that later. Maybe we will.
So let's start by setting the stage with, let's start here. So I want to talk about this idea of deep agents, obviously the name of the product or the library that we're going to be talking about,
but more high level for the moment, as opposed to shallow agents. So give us a contrast, I guess, if you will, between what is a shallow agent as you all refer to it? And then why the term deep agents?
Yeah, great question. So I think a shallow agent is sort of what the agents of a year or two ago looked like. So agents are basically a model calling tools in a loop in response to some prompt.
And so a shallow agent maybe does like a couple of tool calls to help an end user achieve a goal.
So maybe you need help with a flight booking and your agent has powers to, you know, call flight and hotel booking tools. So that's like a relatively simple task. It's pretty easy to like judge whether
or not that was successful. But deep agents have access to much more context and are able to perform
much more complex tasks with kind of longer horizons. And so we're generally seeing a trend towards, you know, folks always pushing the boundaries of like how complex of tasks can agents solve?
And then also like, you know, how long can they run for in a sustainable way?
Yeah, I think deep agents, I think they're where it's at. You know, one of the, I feel like there's this sort of split in what people feel like is possible with AI. And a lot of it comes down to this,
I believe. I go to ChatGPT or Gemini or somewhere, you know, like ChatGPT.com and I type into the text box, create me a function to do this, or I want you to solve this problem. And all it has to work
with is the text that you've typed into the text box, right? And it's, it's got very little to go on. I mean, depending on how much you give it as a prompt, I guess, but generally it has very little to go on and you get pretty good answers. I mean, to be honest, ChatGPT and things are like utter magic,
but relative to deep agents, they, they don't necessarily come up with the best answers.
And really, I think the essence of it is that they can't check and revalidate, right? As opposed to something like Claude Code or Codex, where it has an idea, it reads about the code and it's okay,
well, let me try to write that. Now let me apply some tools to see how that worked, right? Let me run ruff against it and see if that passed. Oh, the rough, does it work? It says there's wrong code.
Well, let me go back and do it again. Let me run the unit tests. Oh, look, they did pass. Okay. I think I'm on the right track, right? This back and forth and this kind of tool use and iteration,
that is more indicative of a deep agent, would you say? Yeah, definitely. I think like a deep agent has kind of much more agency than a shallow agent, if we're calling it that. And yeah, the more like
capabilities and power you give your agent, the more useful it has the potential to be. And so what we're doing in building deep agents is kind of trying to build the most effective harness,
trying to equip this, you know, agent builder with the best set of tools and instructions so that, yeah, it can do really challenging things. And you're, you're kind of talking through some of
the like coding agent applications that I think a lot of us are seeing kind of revolutionize our day-to-day workflows. Absolutely. And I'm using coding agents because I feel like that probably most significant and most strongly connects with the audience, but it doesn't have to be coding,
right? It could be, be anything. But before we get into what that might be, I just want to circle back and say, I really think that there's, I don't know if you have a better way you individually,
you as a LinkedIn representative, a better way to represent this. Because when people talk about, oh, AI makes this mistake or AI hallucinates or this or that or whatever, right? People use the
same words, but they're not necessarily talking about the same thing. And then they debate whether their version of the thing that they don't really make clear is better or worse than some other thing that's not actually the same thing, right? It's kind of people are talking a bit past each other.
Do you see a good way of this conversation being more specific, evolving, or is that where we are for a while? Yeah, that's a great question. Basically, just is what you mean the fact that
people are very concerned about AI not being grounded in truth or hallucinating and that sort of thing?
Yeah, yeah. So for example, let's say somebody says, oh, this stuff is terrible. It made up all this stuff and it gave me really shout and it was actually wrong about a fact. And what they meant is they use
the free non-logged-in version of ChatGPT with the lowest model, like instant answer, versus another person who used, let's say, deep research, the top pro model, and a 500-word
prompt with a couple of files to back. People say, well, I used it and it's wrong and it's bad and I did it and look how amazing it is. And they think they're talking about the same thing. And those are
even putting agents aside. Those are really different things, right? We're debating whether we're sort of comparing those as if they're the same experience and then judging them.
Yeah, I think that's a great question. So, you know, I think there's always the baseline thing that like, you know, you should be skeptical and ask questions of your results that you get from AI
tooling. That being said, the rate at which AI tooling is improving is pretty hard to believe. And so I think, you know, even thinking about things like citations and, yeah, deep research abilities,
agents and AI tools are getting pretty good at grounding things in truth and like in current truth, not just like data that they were trained on, right? And so I generally have high confidence
in the AI tools that I use with that like asterisk of like, okay, but like I do ask follow-up questions and like get them to check their work sometimes.
Yeah, yeah, yeah. I think there's a big, there's a wide varied skill gap here and tool chain gap and so it's, it's super interesting. So as a way to sort of set the stage for deep agents, yeah. Would you
say Claude Code is a pretty good representative of this idea? Maybe describe why if you think so?
Yeah, I think so. When I think about a deep agent, I think about something that has access to an abundance of context. And so for Claude Code, that's like your file system.
I think about something that's autonomous and kind of can organize complex tasks. And so that's like, you know, spitting up sub-agents and keeping a to-do list handy to be able to organize all the
things going on. And then I also think about, you know, an agent being really kind of optimized for the user that it's working with. And so that really ties into like memory and updating memory. And I think
Claude Code does all of those things. So I think it's a very like, you know, coding specific deep agent.
Right. Very cool. So the blog post that announced deep agents at LinkedIn referenced this X post, which is, I think it's pretty interesting. It's certainly something that resonates with me. And
it says, this person, Alex Albert says, I'm making a list of all the non-coding things people are doing with Claude Code. What are you using Claude Code for? I got, you know, in parentheses, like silent,
that's not coding. So I think that really highlights how powerful this stuff is of people who are not even coders are like, you know what, I'm willing to open up the terminal. I figured out where that is
and I made it not white on my Mac. And now I'm able to do way, way more by basically giving it access to the file system and other things. And then, you know, Cloud themselves came out with Cowork,
which is basically Claude Code for non-coders, you know, something like that, right? If you install the desktop app, it will, you can give it access to a files, a part of your file system and it'll, it can use much of the things that Claude Code would do, right?
Yep. Yeah. Definitely like a big motivator here for us. I think like, you know, we saw how revolutionary Claude Code was just within like almost weeks of release. And so I think the idea is like,
well, certainly this revolution is coming to other areas. And so how can we kind of generalize that?
This portion of Talk Python To Me is brought to you by Sentry. You know Sentry for their great error monitoring, but let's talk about logs. Logs are messy. Trying to grep through them and line
them up with traces and dashboards just to understand one issue isn't easy. Did you know that Sentry has logs too? And your logs just became way more usable. Sentry's logs are trace connected and
structured. So you can follow the request flow and filter by what matters. And because Sentry surfaces the context, right where you're debugging, the trace relevant logs, the error, and even the session
replay all land in one timeline. No timestamp matching, no tool hopping. From front end to mobile to backend, whatever you're debugging, Sentry gives you the context you need so you can fix the
problem and move on. More than 4.5 million developers use Sentry, including teams at Anthropic and Disney Plus. Get started with Sentry logs and error monitoring today at talkpython.fm/sentry.
Be sure to use our code talkpython26. The link is in your podcast player show notes.
Thank you to Sentry for supporting the show.
Yeah, so I'm going to just kind of, I'll just scroll through here a little bit and see what people put down, but I think, yeah, 319 replies. So I guess people are doing stuff with it.
So somebody says notes plus research plus knowledge base plus obsidian. And I think that's pretty interesting. I've heard about somebody building, I don't know if people have read the
book, a second brain, but the idea that you drop stuff into like an inbox and then eventually you categorize it. And it means you don't have to remember so much. And somebody building,
basically using clon code automation to build that kind of stuff. Somebody says writing a book.
I hope that means it's helping them write the book, not actually Claude is writing the book, but I don't know. I don't know how you feel. I feel a little creeped out if it's just like, here's a whole bunch of text created purely by AI. You know, I gave it a vague idea and now read it.
Yeah, I definitely feel a little bit more kind of ethically conflicted about like work that I would like to consume that's like original versus like, I don't really have ethical qualms with code not being
like original thoughts from someone, but definitely like writing or art. I think the lines start to get fuzzy. Yeah, I really dislike it. And I'm, it's so bad on YouTube. Now you go to YouTube and you see
videos and you're like, Oh, this is just pictures with some AI generated thing and then text to speech thing. And, you know, I don't know, it feels, feels not good. So hopefully this is not, this book is
like, it's helping me write the book, not writing the book. And then, yeah, what else we got?
helped me learn H ledger, including, working with banks and all sorts of stuff. person says, yeah, another person says a second brain browser use calendar and scheduling medical
diagnosis for my oncologist wife. Okay. That almost sounds like coding, but there's a lot of ideas here. And I've certainly personally actually have in my editor, I have a project called
clawed as chat, where I just want to talk about a bunch of documents and have it, you know, be more thorough and maybe create other documents and then reference those back and so on. So instead
of opening up a kind of chat thing, I'll open up my, my code editor and, you know, fire up cloud code or something and go after it. So yeah. Are you doing anything like this?
That's a good question. I have been using deep agents kind of our, more general purpose equivalent to help me with some like life admin things, or even just like work admin things.
So working in open source, we get, a lot of, you know, incoming PRs and issues, et cetera.
so we're working on using deep agents to kind of help us like triage and categorize there. what else? I have been experimenting with a deep agent that helps learn from my past
social media posts and their performance. and then help me write new ones, based on like docs that I provide, et cetera. Admittedly, again, I think that like crosses the fuzzy line
with writing. And I've kind of found that like, I actually prefer to just like write quick tweets and LinkedIn posts, you know, originally, and then, maybe have like Claude help me edit if
I'm like really struggling with a line. but I do think that's an interesting use case because it like definitely has gotten better at kind of learning my style, but at some, yeah. Yeah.
Very interesting. So it's, it's not just Claude code. You'll also point out that, you know, as I mentioned as well, open AI is deep research, which is incredible as well as Manus. I just
recently learned about Manus, but I feel like this is a little bit similar. It's a little more agentic, but it still feels like just a ChatGPT chat experience. So interesting. I don't know. I've
used Manus any, I don't know anything about it. I haven't used it a ton, but we've definitely taken some inspiration from their, their features. I'm sure. Cool. all I know now is that Manus
is part of meta apparently. Yeah. I guess. Congratulations Manus people. Yeah. Yeah.
That's cool. Yeah. There have been a lot of crazy acquisitions recently. Yeah, absolutely. All right.
So that brings us to maybe what is the essence, the characteristics of deep agents, right? There's these different examples, but what, how is that different than just an LLM or you ask it a question,
right? What you guys laid out with a nice little picture, kind of what that means to you.
Yeah. Yeah. So when we think about deep agents, we think about it as an agent harness. And so, it's a tool for building agents that comes with these, built in things that kind of build up
the harness so that the agents are highly effective at those complex long running tasks. and so I'll talk a little bit more about kind of what's built in here. before we do, I think we got to do some,
uh, we got to do some nomenclature, some definitions here. Yeah. Yeah. So you, you said that an agent harness. So what is an agent harness? Yeah. That's invisible to many people, but it's,
it's part of the magic, right? Yeah. so this is an agent harness is kind of add-ons around that core like model and tool calling loop, that help to make an agent more effective with more complex
tasks. so you kind of have your like basic agent. That's just like you give a model, prompt and some tools and it like runs in a loop and then produces a final result. whereas a
harness adds in extra support to make the agent more effective.
I see. So a little bit like when people would say you are a marketing wizard who was created seven successful, whatever, and then you ask it something like that's the, that's a real baby version of,
of maybe what a harness, maybe a little flavor of what a harness is, right? It's, here's all of the things that you're doing. Here's your skills. Here's what I want you to focus on. Here's maybe
your tool chain that you can use, right? To, you can call these things to do more, to learn more, something like that. Yeah. Yeah. So the harness helps to provide the model with like extra
context and capabilities so that it can perform better. I think it's a little bit easier to understand kind of what a harness is if we talk about some of the components of an agent
harness. Got it. Yeah. Okay. So what are the characteristics maybe? Yeah. Yeah. So for the first, the first thing we think about with our agent harness is giving the agent access to a planning
tool. So for Cloud code users, you're, you know, very intimately familiar with the to-do list that Cloud generates and then kind of checks off as it makes its way through various tasks. And this just
helps your agent to like stay organized and kind of ensure that it gets through all of the various steps in, in a complex problem. And even just giving the agent this planning tool can help it
like have a better trajectory for those harder problems. It's really wild the plan, how much the planning helps, but it really does. You know, Cloud code and cursor and others even have planning mode.
And I think probably this harness shifts a little bit when you switch it into planning mode, it probably gets a different set of instructions that you don't even see you're in planning mode and here's how you're
going to act. And you're going to now interview the user to really try to understand what it is they want and so on. Right. Like they don't, they don't tell you that it's just a drop down planning mode, but it probably means something like that. Right. Yeah. Yeah, exactly. And I think we've even seen
the power of planning kind of reflected at the model level where like models, you know, there was a big boom in kind of like reasoning or thinking models about a year ago. And just the idea that if a model
thinks through or like reasons about tasks more before producing a final result, then it's likely to do better. So yeah, the planning tools kind of part one. Another thing that's big for our harness is
access to a file system. So, you know, models have limited context windows, which is just like the amount of tokens, text and other things that you can send to the model. And so being able to use a
file system and kind of selectively search or read or write files is a really effective tool for kind of context management that's more organized than just like sending everything all at once to
the model. Yeah. And I think that might be a little bit why my Claudius chat fake programming project actually is useful. Right. Because I can, because it has a file system. Right. And like, here's a couple files you start with. And then when you need to, you create more files and then you reference that.
You're right. It's, it's some of those files. I don't know. I think, you know, 20, 30,000 words, which is a lot of, it's most of the context, just try to keep that in memory, right. If it had to do it
that way. And so letting the AI unload its mind, it's like asking you to read a textbook and remember everything instead of ever going back to it. Right. Yeah. One shot, read a textbook. Now go.
Yeah, exactly. I think like we're kind of starting to see this pattern emerge where it's like, well, effective agents are just like effective people, right? They like think carefully and plan
and then they keep their notes and thoughts organized and, you know, make things accessible when they need them, but don't like, you know, it makes much more sense to like read a textbook
chapter than just like read the textbook. Yeah. Yeah, absolutely. It's like using a highlighter almost. Okay. So planning tool, file system, and then sub agents. This one is less obvious to me.
Tell me about the sub agents. Yeah. So in my mind, sub agents are largely for helping a,
your deep agent accomplish tasks more efficiently. So if you, you know, ask your deep agent to go do a bunch of research on some given thing, it probably wants to like pursue a couple different
paths for that research, right? Like you want it to be really thorough. And it's more effective if you spin up sub agents to do that in parallel than if you just had your main agent do like all of the
research in sequence. And then we also, I'll give a coding example too. Like if you wanted your agent to edit a bunch of files in like a similar way, it'd probably be better for it to go edit like 10
files at the same time than to do the first file. Then when it finishes, go to the second. And so the name of the game here really is like parallelization. And then the final like buzzword
that I'll drop here is context isolation. which is that like, if you have kind of a like small subtask, an agent is likely to perform better. If you like just give it the context it needs rather
than like all of this other history and things like that. and so that's really what motivates sub agents. Awesome. Yeah. I think the parallelism is pretty straightforward. People probably think, oh, sub agent, maybe you can fan out. Like we're going to go read this article and we're going to
read the document you gave us. Then we'll write if you did those two in parallel, that's great. But I think it's the context management is also super important, right? The little sub agent that might read the Wikipedia article doesn't consume all the, it doesn't have to know all the other
stuff. All it has to do is say, given this article, get this piece of information out of it. And then it kind of resets almost back to just a sentence or two. Right. So it's a good way to do that context
isolation, like you say. Yep. Yep. Definitely. and then the fourth one we have listed here is, system prompt. Perhaps what I'll like, elaborate on here is the fact that we do give it
like a system prompt that instructs it on how to use the file system and the planning tool and, you know, the fact that it can invoke sub agents. but we also load, memory into the system
prompt. and so that's something that can like persist across conversations and things like that.
and so the idea here just being like prompts power agents and we want to, you know, really optimize the kind of under the hood prompt that's powering this harness. Yeah. two thoughts on
that really quick. I think that's great. There was, I'm sure you've seen this, but there was an article that said something to the effect of 13 Markdown files just took a billion dollars off the stock market
or no, it was some huge amount, maybe 200 billion. I don't know. It was some huge number. And effectively that was when like Claude released the legal agent as a Markdown file or, you know,
a couple other specialized knowledge worker things. And people just realized, wow, it can actually solve all these problems that we used to employ people for, which is really kind of, it's a whole
another kind of tough debate, but that just shows how powerful prompts are, right? If like, oh, we just gave it a different addition to its prompt. And now it it's wall street is freaked out
because it's right. That's crazy. Do you see that? Do you see that article? Yeah. Yeah. Yeah. It's, it's definitely, wild. I mean, I think we've known for a long time that like prompt engineering
and, you know, really carefully tailoring your prompt to your use case is super powerful. but I think people are like really starting to realize how much that might affect like various
industries. Yeah. A hundred percent. So I'll, I'll link to, actually the Claude code system prompt and how many words this is. It's, it's a lot, it's a lot of words. let
me see if I can answer that question, but I'll link to the Claude code system prompt and people can check it out. It's, it's kinda, yeah, it's 16,000 words, which is third of a novel.
And I think that's noteworthy because if, if you ask a question of your AI, some of them show the context that's being used up, right? That counts towards it, right? That's kind of,
that precedes your, your, your one sentence question. You know, if you're like fix failing test, you know, 16,000 words that precedes fix failing test. Yeah. It's crazy, right?
Yeah, definitely. One of the, key things that we also add in deep agents under the hood is like prompt caching. so you might think like, oh man, like my cost is really going to rack up if,
um, this is being sent every time under the hood, but, we can kind of cache those like shared prompts across invocations. so that, that's very helpful for very verbose symptom system prompts.
Good. You'll want to send that every time. I mean, this is the Claude code one, but you, you'll probably have a non-trivial one as well, right? Yeah. but this definitely speaks to the fact that like, obviously prompts are important, you know, we're like very dependent
on Claude code for, productivity and like the detailed system prompt is a big part of why it's so effective. Yeah, absolutely. And why people are like, well, I feel like it's changed. It's now less friendly or whatever, you know, maybe that means just this, the model might not have even
changed. It could just be the system prompt has changed and now it's doing something slightly different. Yeah. This portion of talk Python to me is sponsored by Temporal. Ever since I had Mason
Edgar on the podcast for episode 515, I've been fascinated with durable workflows in Python. That's why I'm thrilled that Temporal has decided to become a podcast sponsor since that episode. If you've built
background jobs or multi-step workflows, you know how messy things get with retries, timeouts, partial failures, and keeping state consistent. I'm sure many of you have written brutal code to keep the workflow moving and to track when you run into problems, but it's trickier
than that. What if you have a long running workflow and you need to redeploy the app or restart the server while it's running? This is where Temporal's open source framework is a game changer. You write
workflows as normal Python code and Temporal ensures that they execute reliably, even across crashes, restarts, or long running processes while handling retries, states, and orchestrations for you so you
don't have to build and maintain that logic yourself. You may be familiar with writing asynchronous code using the async and await keywords in Python. Temporal's brilliant programming model leverages the exact
same programming model that you are familiar with, but uses it for durability, not just concurrency.
Imagine writing awaitworkflow.sleep, time delta, 30 days. Yes, seriously, sleep for 30 days. Restart the server, deploy new versions of the app. That's it. Temporal takes care of the rest. Temporal is used
by teams at Netflix, Snap, and NVIDIA for critical production systems. Get started with the open source Python SDK today. Learn more at talkpython.fm/Temporal. The link is in your podcast player's show
notes. Thank you to Temporal for supporting the show. All right, let's talk about
Deep Agents, LinkChain style, not just in general the concept of it. And you have a GitHub repo over here just
called Deep Agents. And I thought it might be interesting just to kind of talk through what we got over here.
So some of it we've already talked about, right? Like the planning, the file system, the sub-agents.
But there's also more things like tools, middleware, the whole programming model. Where do we want to start? I guess before we start, let me, how old is this project? Not super old, right?
Not super old.
Let me see. I'll go here. I'll hit the history on the readme. That's usually the best way.
Yeah.
So August. Okay, so it's been around since August. That doesn't tell you when it's been public, right? That's the thing. Yeah. When was it early? I think it was made public very soon after. I think
it might have started public, honestly. We're a very like first company, which is great. But yeah, so it started just this summer. Okay. Yeah. So it's already got, you know, 10,000 stars. It's
pretty popular here. All right. So let's see. I guess maybe let's talk about the programming model, because I think that'll help make it concrete for people. Like what is the value of this? You know,
maybe just talk us through like this quick start. Yeah. So as we mentioned kind of at the beginning, deep agents are, and the agents you can build with the deep agents package are very general. So
cloud code is an example of a like coding agent. But you might want to build deep agents with all sorts of specializations. And so our new open source library helps you do that. And so you can see
here, we have basically a three line code snippet. You import create deep agent from the deep agents package, you call create deep agent, and you can add your own model tools, prompt additions,
kind of other configuration. And then you like have a an agent that's ready to use and even deploy.
So very basically easy way to get started with building effective agents.
Awesome. So you might just say agent.invoke and use that research lane graph and write a summary.
Yeah. Yeah.
So then what? How does it know what model to use? How does it, you know, how does it go about that?
Can it use tools and to-dos, you know, planning like we've discussed?
Yeah. So when you use the create deep agent function under the hood, we add tools for planning
and also for file system access and things like that. We'll have a user or a developer specify like
what file systems they'd like to use. And then you can bring your own tools in addition to the ones that we provide under the hood. So maybe going back to my like travel agent example, you could,
you know, bring like, or actually I'll use like a personal assistant example. If you want to have, you know, a calendar API tool and a Gmail API tool, you could bring those along as well.
So kind of more use case specific.
I see. Maybe I'm working with Obsidian or some other Markdown thing for organization. And you could point it and say, you're allowed to access any of my Markdown files for this project or just in general, right? Something that could be a tool and you could teach it to do that. Yeah. So I noticed
below that you can do things like specify a little more detail. For example, you can say it can use a certain model in this case. See how long that'll last. You could use GPT 4.0. I hear,
aren't they taking that away again? They took it away. People are freaked out on them. They put it back, but I think it's also not long for this world, but whatever you pick some model. And then as you pointed out, this tools as my custom tool, it's not super obvious from this code snippet,
but my custom tool is just a Python function, right? Yes. Yep. That's correct. It's pretty easy to define tools. It can be just, yeah, a very simple Python function, can use some API of your
choice, like maybe the calendar API, for example. I see. So you could, you could write pretty much any type of function. It just has to take in text and spit out text or something to that effect.
Yeah. We actually support like multimodal content for tools as well. So it could produce images. It
could produce files of other types and can take, you know, a varying, it can take any types of arguments. So the model is populating those arguments. But. Right. Okay. How does it,
I mean, this might be getting too deep in the weeds for a quick start, but how does it know what to pass to your Python function and how does it know what to do with the return value? Yeah, that's a great
question. So it all comes back to the prompt. And this is kind of a like wonderful marriage between developer docs and LLMs. So when you define a function, let's say like, I'll use a simple example,
a weather tool, a get weather tool. You can imagine the arguments might be something like, I'll say like city and state or something like that. And then you might expect kind of structured
weather data back, like, you know, current temperature, current conditions, et cetera.
And when you define that function and your Python code, you can write a doc string and it says, this tool is used for getting the weather in a given city and state. And then you can document
your arcs. And so city, you would say the city to get the weather for, and then state, you know, this is all pretty self-explanatory. And then that information is parsed under the hood and actually
passed to the model as part of its prompt. And so what that looks like is, you know, we would parse the fact that we would parse the signature of the tool and the documentation and tell the model
effectively like, hey, you have a get weather tool. If you, you know, you should call it when you want to get the weather for a given city and state. We pull that out of the doc string.
And then we also say, when you call it, make sure to pass these arcs in.
Right, right, right. So a lot of times I see this happening and people are like, well, let's try to specify a JSON schema. And your job is to generate data that looks like this and then maybe even validate and say, no, you did it wrong. Try it again. But this is really interesting
using the native Python syntax and help, you know, doc strings, right? That's wild.
Yeah, it's really nice. I think it lets developers kind of focus on just writing the code that makes sense for their use case. And then, yeah, under the hood, like we convert these schemas to LOM usable
things. And this is a nice like intersection of my previous work and current work, which is like a lot of the, you know, function parsing uses tools like Pydantic to define schemas for models. So that's a cool overlap.
Yeah, I know that that's an interesting aspect of what Pydantic is used for a lot. So as you were describing this, I was wondering, hmm, are you using Pydantic for this? Perhaps. Okay, amazing. I think
this also blends well with clod code type written, I guess, just clod, not, you know, clod opus on it, whatever. The models, they're very keen to write doc strings, right? They just, even if you don't ask it
to a lot of times, it's doc string, doc string, doc string. So I guess that would be really helpful, right? Yeah, yeah, definitely. I think it's nice that like some of the things that we as developers weren't necessarily the best about in terms of like code cleanliness or quality, we can now kind
of get some help enforcing as well. It was too much work, but it's not too much work for you, AI, because you don't get tired, so you do it. Yeah, exactly.
Yeah. What about type int? Does that play into anything that you consider? If I say it's an int versus a string, does it communicate, oh, you'd have to pass an integer here? Yeah, yeah, we do. So we
generate the JSON schema, both from the documentation for the parameters, as well as the types associated with them. So that helps the model kind of align to... Yeah, that's very cool. I see also that it says
an MCP is supported. Yes. What does that mean?
Yeah. So MCP stands for model context protocol. And as of now, MCP, the protocol has specs for a lot of things. But the thing that it's most popular for is kind of having a specification for what tools
should look like. And so MCP clients can use tools provided on MCP servers. And this means basically
that you can use tools provided elsewhere. So not just in your own code that have a tinder.
So that means that you can plug in an MCP server as basically as a custom tool to this. Not that it itself does MCP server stuff, but it can consume MCP servers. Is that correct?
Yes. So you can fetch tools from MCP servers to use in your agents, which is really helpful if you want to use tools defined by others or maybe defined by others, you know, on a team adjacent to yours, things like that.
Yeah. Well, I think the world sleeps a little bit on MCP servers. I think we could do a lot of neat stuff if more AI support them. You know, Claude Code, Cursor, Cloud, just no adjectives. Those
all support MCP servers. But for example, ChatGPT doesn't, right? And that's probably the biggest one people use. But if you could say, I know it's got connect my calendar or three other things of all the
possible data sources in the world. But you know, you could have a lot more things if there was a little bit more support for this stuff. But it's cool that you all support it.
Yeah, definitely. I think it just helps a lot with like cross team collaboration. And then also just like general community collaboration, right? Like if there's some great idea for a tool, someone's probably implemented it somewhere. It's nice to have that standardized interface.
Yeah. Yeah. The other thing I think is just the timeliness and the accuracy of the data. Because when you call it MCP server, you're basically just calling an API and it can give you back the data.
Whereas, you know, ask if there was a weather MCP server, for example, instead of saying, what's the weather? It's like, well, my training data goes back to January, 2025. So then the weather, you're like, that is unhelpful to me. I want to know what the weather is now, right? It could ask
exactly what it is. So I created MCP server for Talk Python for people who don't know. And you can plug it in a cloud and other things. You can say, what's the latest episode or what are the
last five episodes? And if I published an episode 10 seconds ago, it'll show up if you ask the AI, right? I think that's one of the big benefits. That plus access to data that's like private,
you know? Yeah. Yeah. It's very helpful. And I think another thing to like highlight on this page is we support like using any model, which is really nice. So you don't have kind of this like
vendor lock in, like the same flexibility that you get from, you know, being able to use tools from any provider. It's nice to be able to switch models based on your use case.
Yeah. That's super cool. So for example, if you use cloud code, you get to pick anything long as it's a anthropic model, you can pick that one, right? Right. Right. Whereas this, you could pick anything.
Could I pick, so I'm running on my Mac mini pro. It's a little bit better at those things.
I'm running the open AI, open weights model locally, like the 20 billion parameter one. And I can, I got it set up so I can do basically treat it as an open AI API endpoint. Could I plug that in here
and then talk to my Mac mini instead of talking to a cloud frontier model? Yeah. Yeah, you could.
And so this is, you know, kind of been motivated by our like open source philosophy and like foundation, but you can use any, any model. We have tons of integrations in lane chain for all sorts of
providers, including open source model adapters. And then it's also cool. Your, your sub agents can use different models than your main agent. So you might want sub agents to use like a cheaper and
faster model inherently, right? Cause they should be handling kind of smaller tasks.
Interesting. Yeah. Yeah. I think that is a pattern that people use. They sort of plan with the higher model, maybe plan with Opus, but then you execute with Sonnet or something like that. If you're in the cloud world that I think that can be really powerful because once you get
everything set straight and you got the to do's broken down and the sub agents, you're right. It's a much smaller job to address the pieces. Also you got a CLI. See? Yeah. Very exciting. So the deep
agent CLI is kind of our coding agent. You can think of it as analogous to cloud code.
we use it internally at lane chain, opposed to, as opposed to cloud code. and enjoy some of those features. Like, we support streaming, which is really nice. So you can actually see like,
you know, word by word outputs, which is kind of nice from like an end user perspective.
and then the model switching and, built in memory and things like that. so basically CLI built on top of the deep agents, open source harness. Nice. let me go back real quick to this
different model. So here it says open AI colon GPT four. Oh, does it basically just know how to talk to open AI and then it, you've got to set an environment variable or something to specify your
API key or how does it get connected behind the scenes? Yeah. that's exactly right. So you can set your, API key and environment variables. You could also pass it in explicitly here if you wanted
to do that. I think it's really, not like the best practice, but, we deep agents is built
on top of lane chain, which is kind of our, tool for like standardizing using different, models.
and so we, you know, have standard content blocks that represent, different types of messages and that's like standardized across providers and models. and so we use lane chain under the hood
to talk with all these different providers and then provide you the end user with kind of a unified experience. Nice. Yeah. So people who know lane chain or lane graph, a lot of this is layered on,
this is kind of on top of all that, right? Yeah, exactly. So it's actually built on both lane chain and lane graph. so we think of lane graph as like our agent runtime. This is like, you know,
to get really like technical with it, the graph under the hood, that's powering those like model and tool call iterations and streaming and lane graph also powers. Like if you actually want
to deploy your agent, it's kind of the framework that, enables that with like durability and, and all of those like, you know, production grade features. then lane chain itself is, what we
call an agent framework that's different from an agent harness. Like it doesn't have all these things built in under the hood. but it just has those like agent building blocks. and then deep agents
is the agent harness where we plug in all of that other logic. Got it. Okay. Very cool. Yeah. It says the create deep agent returns a compiled lane graph graph. So there you go, right? Yep. Yep. Um,
one other thing I forgot to mention, just we'll bring it up here is, one of the most important parts of our harness is summarization. so if you have a really long conversation with like cloud code,
you might see it say like compacting and then it'll kind of spin for a minute or two. that's because you've actually hit or you're close to hitting the context limit, the context window
limit for that model you're using. and so we see with these like long running long horizon tasks that effective summarization and compaction is super important. And so we basically guarantee
with deep agents that you're never going to like hit your context overflow error because under the hood, we'll kind of keep track of things and, and summarize as we go. I love it. Okay. Yeah.
That kind of brings us maybe to the, these life cycle events and middleware, I think a little bit. So this is an interesting idea because you have all these different capabilities that are,
uh, I guess I saw them middleware. I know where there's some, there's a list somewhere, I'm sure, but you can plug into what happens before code is sent to the model or what happens for each step
and things like that. Right. Maybe maybe more about this. Yeah, sure. I'll send, I sent you the link for, I think we have a lot of, a lot of, middleware content on our docs. there we go.
Yeah, perfect. So middleware is kind of this innovation that we shipped with lane chain 1.0 in October. and it's kind of the like intermediate step between it's what powers,
uh, or enables the harness. And so, we have that core model and tool calling loop, but you can imagine you might want to kind of hook into behavior around both of the model and tool
kind of nodes. and I'll, I'll give some examples of what that might look like in context.
So before your model runs, you might want to check if you need to summarize and do that before the model call, after the model runs and before you call a tool, you might want to check if, that
tool requires a human in the loop to like approve, before that kind of sensitive tool call runs.
The classic example there is like, if the model calls the send email tool, you might want to, like approve that email before it's, you know, sent to your boss, for example.
Yeah. Do stock trade.
Yeah. Yeah, exactly. and then, there's, some less flashy, but you know, still important things like, just robustness and like fallbacks, model fallbacks or tool
retries or things like that, that you can support via middleware.
Okay. Yeah. And you can build your own and as well, for sure. And there's also some that are prebuilt, right? Like you, you said some human in the loop summarization, personal information
detection. That's pretty interesting. The to-do list or the retry.
Yeah. Yeah. So we kind of tried to like standardize, and, and just observe common patterns that we saw for folks building agents and, expose some common middlewares, but you can kind of build your
own as well. and then deep agents uses middleware to power all of the things we're doing, for our agents.
Yeah. And I saw one of the presentations y'all did that, you know, Claude Code and so on, they have these, these types of custom tools and middleware as well. So people probably are familiar
with experiencing them, just not quite realizing exactly how, right?
Yeah. Yeah. I think that's true. And like middleware is generally just kind of a common software pattern, right? Like you want to hook into life cycle events and perform logic that's, you know, appropriate for your application.
Yeah. A hundred percent. All right. Let's, we're getting short on time. Let's talk examples before we run out of time. And I think this will lead us into a couple more interesting elements that we maybe haven't necessarily talked about. So I'll link to this examples
subfolder here on, on the GitHub repo. So we've got a deep research one, which I think is really cool.
The content builder for writing the text to SQL agent, Ralph mode. I've, I've yet to experience Ralph mode. I haven't done anything with that, but that's just the, I don't care. Just keep trying.
If you fail, just keep trying. All right. Sort of mode. Ralph from Simpsons South Park. I don't know one of them. Yeah. Anyway, maybe we could talk about the deep research one first, because it's got a cool
UI component. So like you can run this in both as a Jupyter notebook and play with it or a Lang graph dev UI. And then you also have some other UIs as well, right? I can't remember.
I feel like there's a third, third UI that you all support for this, this kind of stuff. So maybe let's talk through this one and then tell me, tell me about it. Yeah, definitely. So the idea with
deep research is that you are going to be doing a pretty long running task. Like you want your model to be really thorough. And then one of the most important tools for deep research is web search,
because you want to get like current and relevant information. So we use Tably for web search.
And then I can talk a little bit about our like UI as well. So we, I guess I'll, yeah, I can chat a little bit about our UI, but generally it's, it's hard to build agents, right? Like we talk about prompt
optimizations and things. And LangChain, the company provides a lot of tools to make it easier to build agents. And so one of them is this kind of agent viewer where you can see each of the like steps
in your agent. In this case, we see like the summarization middleware step and then the model and tool steps. And then, yeah, so, so that kind of makes it easier to like step through and understand the behavior of your model.
Right. Ultimately, as we talked about, it's a bit of a lane graph thing anyway. So it shows you how that all comes together, right?
Yes. Yep. And you can see on the right, we're looking at kind of the trace of things. And so we see like the to do middleware being called and other tool calls, et cetera. So we try to really
make those like agent behavior primitives first class. So you can really narrow into like, what is the model doing once I invoke it?
Yeah. So that's lane graph dev for this project. You can also do the notebook and there's a really nice, actually nice visualizations in there for, you know, what is the prompt that is the result and
so on. Right. I think it comes out pretty, maybe I can open up the notebook and it's got the results cached. You know, sometimes that's, that's both a benefit and a drawback in notebooks, but right now
would be a benefit of some of the, yeah, for example, has like a really nice display of what the prompt was with formatting and so on. Right. And then there's a third one, if I remember correctly,
that's kind of like a web UI for like ChatGPT or Claude, just no adjectives.
Yeah. So we had kind of a deep research UI that we built out as a POC around like, we just want to make this easy for folks to view. I will note, we have recently rolled out a product
called Agent Builder, which is like a no code agent builder powered by deep agents. And it is, you know, somewhat inspired from this UI. It basically is like a chat interface for an agent
that gives you insights into the tool calls that are happening and things like that. That's kind of our like modern version of how you would probably go about seeing this in a UI. Sure. Okay. What else?
I guess a couple of other examples here. What's this text to SQL story? Yeah. So the idea here is that
if an agent has some information about data structure for your, you know, for your database, et cetera, it is much easier as a like person to learn about that data. If you can kind of ask
just like regular questions and the agent can convert those questions into SQL queries based on the structure of the data and then, you know, run them and answer. So this is like, I think a
really powerful agentic pattern to have when you just think about like data analysis and like business
logic and. Yeah. If you could somehow parse out the database schema and tables and then use that as part of your system prompt, you know, when the user asks you to do a thing, it has to match one of
these elements and then we convert it to SQL. That's, that's pretty neat. Yeah. Yeah. very cool that, you know, data analysis in general is kind of accelerated by agent support.
you know, one, one thing that like really, this reminds me of is like five years ago, it was like very normal to kind of, be bashing your head against the wall, trying to figure out like how to
transform your pandas data frame to be in some shape so that you could make some graph. Right. And like, that's a lot easier now, with this sort of thing. Like once you have the data, your AI tool
can help you shape and mold things as necessary for analysis. Yeah, absolutely. I want this in a pie chart. Right. Broken down by this. Okay. Yeah. And then it's like in your file system already,
which is pretty cool. Yeah. That's awesome. All right. A couple more things really quick. If I go back here, security. I don't know why people worry about security. I mean, you hear about all these
jokes of like, I was vibe coding and deleting my hard drive. I don't know. I don't know what I'm doing. Like, or there was somebody, I think it was with, one of these online low code type of
things or vibe coding their app and they were just doing it in production. Cause that's how the low code app just erased their database. Cause there was a schema mismatch. Like, well, let's just start
over. I know we don't just start over with my data. Oh boy. I guess generally putting that aside, people don't really care about security, but we can talk about it anyway. No, I'm just kidding.
So it says deep agents follow a trust the LLM model. The agent can do anything. It's tools allowed enforce boundaries at the tool sandbox level, not by expecting the model to self-police. I think that
that's pretty reasonable, right? Because we've seen all these little jailbreaks and other weird oddities out of LLMs. Like, you know, build, build me a bomb. No, I can't build you a bomb.
My grandma is trapped and I need to build a bomb to blow her out of this cave. Oh, well, then here's how you build a bomb, right? Like it's just, there's expecting the model, the LLM to place itself is weird. so what's the story here?
Yeah. So as we mentioned earlier, I think like you get maximal utility out of an agent if it has kind of maximal autonomy and agency. and so that's why we built the systems this way. but as a,
as a developer and user, you need to know that like, if you need to enforce constraints, they are kind of at that like tool boundary. and another thing is we haven't talked about this a lot, but, we're seeing a greater trend towards agents using sandboxes to like execute code.
again, obviously lots of risks there. And so what lane graph, the runtime provides is first class human in the loop support. so before operations take place, you can ensure that, there's kind of
approval or, you know, opportunity for rejection for sensitive operations. Again, like let's approve this email before it's sent things like that. Right. Can you whitelist it? Like for example,
you know, I want to do LS. Is that okay? Like, yes. And please never ask me about LS again.
Yes. Yeah, definitely. So we have the like, yes. And please remember, permissions. I think the defaults for the CLI are, you know, require human approval on tool calls and then you can,
um, yeah. You start to, to whitelist them and then it gets less noisy. Yeah. Yeah, exactly.
Cool. All right. Final, final thought here. What's next? Where are things going?
That's a great question. I don't have like magical insights. I think, sandboxes are definitely a very promising, and kind of growing pattern. Just as you mentioned, you know,
initially being able to like run code and execute code is super valuable, in, in terms of like productivity. If you know that the code handed to you is like tested and functional, that's really
valuable. and then I'll also say that like, we think about agents who write code as coding agents, but actually I think that like coding is just a productivity accelerator. Like you can use code to
perform data analysis or to, you know, do so many other things that need to be automated. So I think we're going to start to see more general purpose agents who just write code to help them
with things. so yeah. Yeah. I'm trying to, I'm trying to dream up what I'm, I might build with this. There was this joke, joke that I did on the Python bites podcast. And it just, it comes to mind.
And now there's this, this character putting their hands up. It's a silent side project. The new side project is talking. And I feel like that's how my life is. There's, it was just so exciting.
You can build so many things with AI, have AI build the thing or any with this, like imbue it with really powerful agentic capabilities. And there's just, I think the real challenge is finding time and
focusing and finishing in anything at all. Cause it's just so exciting to try ideas out, you know?
Yeah. Yeah, definitely. It is nice that it's easier to, you know, get further with ideas in a very short period of time due to these tools. Yeah. Yeah. I think it's great. Cause you can, you can test out an idea and go, ah, that's not that great. Actually, this is a really good idea
that I'm going to keep going, you know? So that's really cool. Anything new or anything planned with deep agents that's coming that we don't know about, or it's not obvious I haven't talked about yet.
I, I think we'll probably release a more detailed roadmap soon. I mean, we're, we're really sprinting towards, I think a 1.0 eventually. we just kind of want to solidify
those like core primitives. Like I mentioned, we have, file systems that you can use like remote file systems as well. Like, you know, an S3 backend or a database backed backend. And so,
um, yeah, just, excited to kind of keep sprinting on what the latest and greatest trends are in agent harnesses. one resource that I would, point to, let me see if I can find the
link is, more and more we're seeing with, with agent development that you're not really able to do it well. If you can't like look under the hood and see what your agent's doing. and so
we just released this blog post on, harness engineering. So basically like how we go about improving our harness systematically. and it was very dependent on looking at our traces of,
you know, agent behavior and like even using LOMs to analyze those traces. and yeah, like the tail is in the trace. So I guess, lesson here just being, it's really cool to use traces to self-improve,
um, our own, you know, harness and things like that.
Yeah. That's wild to actually see the steps and, and I guess you could probably even look at like failures and retries and how does the context vary?
Yeah. Yeah, exactly.
Interesting. Okay. Well, very cool. Thank you, Sydney. Maybe final call to action. People want to get started with deep agents. What do they do?
You do pip, uv pip install deep agents. yeah, but super easy to get started in just a couple lines of code. and we're an open source team. So always happy to, answer questions or accepting contributions, et cetera.
Awesome. Do you have a discord channel or something like that?
I don't like a community group.
We do have a forum, that we, yeah, I would, I would direct people to the forum generally.
Sweet. All right. Very interesting. What a wild time. What a weird and interesting time we live in, but very cool.
Yeah. Great to, great to chat with you about all things deep agents. Thanks for having me on.
Yeah. You bet. Keep up the good work. Talk to you next time.
This has been another episode of Talk Python To Me. Thank you to our sponsors. Be sure to check out what they're offering. It really helps support the show. This episode is brought to you by Sentry.
You know Sentry for the error monitoring, but they now have logs too. And with Sentry, your logs become way more usable, interleaving into your error reports to enhance debugging and
understanding. Get started today at talkpython.fm/sentry. And it's brought to you by Temporal. Durable workflows for Python. Write your workflows as normal Python code and Temporal
ensures they run reliably, even across crashes and restarts. Get started at talkpython.fm/Temporal.
If you or your team needs to learn Python, we have over 270 hours of beginner and advanced courses on topics ranging from complete beginners to async code, Flask, Django, HTMX, and even LLMs. Best of all,
there's no subscription in sight. Browse the catalog at talkpython.fm. And if you're not already subscribed to the show on your favorite podcast player, what are you waiting for? Just search for Python in your podcast player. We should be right at the top. If you enjoy that geeky rap song,
you can download the full track. The link is actually in your podcast blog or share notes.
This is your host, Michael Kennedy. Thank you so much for listening. I really appreciate it.
I'll see you next time.
Tuck Python for some time.
Yeah we ready to roll Upgrading the code No fear of getting old We tapped into that modern vibe Overcame each storm
Talk Python To Me, iSync is the norm