Thariq Profile picture
Sep 17, 2025 7 tweets 3 min read Read on X
Making an Email Agent using the Claude Code SDK

If I wasn’t at Anthropic, I would be making agents using the Claude Code SDK.

But doing > talking. So I’m building in public and open sourcing a local email agent.

This is part one on agentic search.
First, why the Claude Code SDK?

Whenever I’ve built an agent in the past I ended up hand rolling the same patterns that are now just way easier to use the Claude Code SDK.

In this example I’m using it for subagents, context management, the file system & code generation.
Building Context

Email has a ton of context on me. My ideal agent should be able to (with permission):

- Know info about me like my address, phone number, etc
- Write intros based on the context I have with contacts
- Find all relevant emails to draft a response
Previous generation LLMs would use RAG to find relevant emails to put into context.

RAG is fast, but noisy and hard to maintain. In this case, I would have to index my entire inbox and keep it up to date with each email.

imo this is why a lot of lastgen AI email didn't work Image
With the Claude Code SDK you can use Agentic Search.

Instead of passing it in a fixed context, you let it search your inbox like a human would (e.g. by email addresses and text) to find and build its context Image
I have a search subagent that can search my inbox, but here’s the twist-

Instead of the tool call returning an array of emails, it writes it to a log file and then it uses grep to search across these files.

This performed way better and is super easy with the SDK.Image
What does this mean? I can get my agent to build a profile for me from scratch just by agentically searching my inbox.

This is what that looks like right now, it honestly surprised me by how much it was able to find.

Open source repo coming soon! Image

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Thariq

Thariq Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @trq212

Jan 9
Yesterday we tightened our safeguards against spoofing the Claude Code harness after accounts were banned for triggering abuse filters from third-party harnesses using Claude subscriptions.
Third-party harnesses using Claude subscriptions create problems for users and are prohibited by our Terms of Service.

They generate unusual traffic patterns without any of the usual telemetry that the Claude Code harness provides, making it really hard for us to help debug when they have questions about rate limit usage or account bans and they don’t have any other avenue for this support.
This is why the supported way to use Claude in your own tools is via the API. We genuinely want people building on Claude, including other coding agents and harnesses, and we know developers have broad preferences for different tool ergonomics.

If you're a maintainer of a third-party tool and want to chat about integration paths, my DMs are open.
Read 5 tweets
Jan 4
If you started using Claude Code over the holidays, you might be curious about how AI actually works, the benefits and risks, and where it's headed.

Here are some of my favorite papers on alignment, interpretability, and societal impacts 🧵
First Dario's essay on Machines of Loving Grace.

Why is it worth building AI, despite the risks? Because if we do it right the future can be radically good.

darioamodei.com/essay/machines…
How do they work?

LLMs are not as complex as you might think.

I've really enjoyed 3blue1brown's breakdown of concepts like neural networks, gradient descent, transformers and attention.

Read 7 tweets
Dec 17, 2025
We’ve rewritten Claude Code’s terminal rendering system to reduce flickering by roughly 85%.

We wanted to share more about why this was so difficult, how the fix works and how we used Claude Code to fix it 🧵
When rendering in a terminal there are two regions: the viewport at the bottom and the scrollback buffer above it.

When content exceeds the viewport height, the top row gets pushed into scrollback and some of the rendering happens offscreen. Image
Unlike regular CLI tools that print output and exit, Claude Code is a long-running interactive UI. We redraw our viewport dozens of times per second.

When we render offscreen or the terminal resizes, we have to clear the scrollback each time. That's the flicker. Image
Read 9 tweets
Nov 13, 2025
We've released a new frontend-design plugin for Claude Code.

Here's Claude's output for: "use the frontend design skill. Create a music player app."
To get started add our marketplace in Claude Code:

/plugin marketplace add anthropics/claude-code

and then install the plugin:

/plugin install frontend-design@claude-code-pluginsImage
Some other examples, Claude is really cooking here. Image
Image

Read 4 tweets
Nov 12, 2025
We built a Deep Research demo for the Claude Agent SDK!

It's one our most requested use cases: spawn multiple AI agents to research a topic in parallel, then synthesize their findings into a report.

🧵 on how it works: Image
At a high level:
- the main agent breaks your request into 2-4 subtopics
- it spawns researcher subagents in parallel to search the web
- each researcher saves findings to files/research_notes
- the main agent then spawns report-writer to create final report in files/reports
Using files is a great way of handling subagent communication.

Research subagents can save their findings to files and then the main agent can search across them to make sure the relevant information has been found.
Read 5 tweets
Nov 11, 2025
🧵 Making Proactive Agents with Code Generation

Last week we shared about how you can use code generation to compose tools.

But code generation can also give your agents new capabilities- like proactively acting on your behalf.
In this case, I want to make an email agent that processes my emails.

Running an agent on every email I receive would be slow & unpredictable, so instead I'm allowing the user to generate callbacks that are called when I get an email.

Here's an example generated function: Image
When doing code generation, I like to think in terms of files that execute, instead of evaluating code in a repl. Files allow Claude to verify its work, create helper scripts, etc.

In my email agent, listeners are scripts in a folder that store logs as well. Image
Read 5 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(