Another insane use case with Claude Code | Self-Improving AI Agents

Elvis Saravia · Intermediate ·🧠 Large Language Models ·12mo ago

Key Takeaways

The video demonstrates building a self-improving agentic system with Claude Code sub agents and slash commands, showcasing an evaluator-optimizer architecture for generating high-quality content.

Full Transcript

Hey everyone. So yesterday I posted something about sub agents and how you can combine that with flash commands to get more reliable results from your cloud code sub aents and I actually wanted to explore this idea a little bit further. What more advanced agentic architectures we can explore. One idea that I use a lot is this idea of evaluator optimizer. The idea is that we have an evaluator which assesses how good the content that's generated by our agent or your agentic workflow. In this case, we have a really simple example of an agent that creates a post given a URL. So, this would be something like for X or any other social media platform. So, this creates a post draft. The post evaluator assesses it based in some criteria rubric that I've provided the agent. Then, it provides some feedback. If the post generator generates something of high quality, then we are going to approve that post. And finally, we're going to get an output. So, how to orchestrate something like this inside of cloud code? That's what I want to show in this video. So here I'm on cloud code and I've already set up my post evaluator agent and post generator agent. The post generator agent basically just creates this task to generate a spicy engaging and technical post for the X platform and it needs to keep the length to 200 to 300 words and then I have the post evaluator agent and this one is tasked to assess the output of the post generator agent given some criteria. it needs to produce a score between zero and 100 for each one of these dimensions and then provide a final score. Once we can produce that final score, then we can sort of assess whether the post that was generated by the post generator can be approved. I did not put that logic here because what I found with any evaluator agent that I've created, it tries to take shortcuts and introduces biases. For example, it was just output a really high score just to meet that criteria. So I wanted to leave that logic out of the agent and put that somewhere else. So where would I put that? And this is where the idea of slash commands comes into play. So I have the logic baked here. But I also have additional highlevel instructions for how these agents should interact with each other. In this case, because we want to generate the post and also use this evaluator to provide feedback. All of that instruction is here. And notice that I have this loop here which is iterate over a step one to three until the post evaluator agent grades the post with a score of 90 or higher. So that logic that I was explaining is something that I baked into this flash command. If we get an approved post, we'll save that in a folder. And that's pretty much it. So this is building on that idea that I posted about yesterday of using sub agents and orchestrating the way the sub agents communicate and complete tasks. In this case, I am interested in creating this loop. So I'm testing the idea. This is the first iteration of it. So it's not perfect, but essentially what I want is I want to be able to create more complex interactions between the sub agents. And so I'm not going to leave that orchestration to cloud code to decide because this is a really custom agentic workflow that I'm interested in developing just to show you how that works. Now I was just use the slash command post generator and then provided a URL. The URL is now provided as an argument and the two agents can then start to perform the task. So the post generator would generate the post. The evaluator agent will evaluate the post. Then the evaluator agent sends that feedback to the post generator and then we do the iteration order loop that ensures that on every iteration hopefully there is an improvement on the post. Let's look at a concrete example of how these sub aents interact with each other and whether this actually works. You can see here that the post generator generated a post and then the post evaluator evaluated it. It gave it a 77.5 score which doesn't meet the 90 threshold. So then it's going to send that back to the post generator as feedback and then it's going to try to improve. You can see here improve post based on feedback. One thing I want you to pay attention here is the number of tokens. Because this use case is sending back and forth information, you could expect that the amount of tokens used is going to be really high. So be very careful when you're playing around with this particular architecture. There's a lot of little optimizations that I can implement between these sub agents. But this is the first iteration. I definitely have a lot to improve. You can see that the post generator, the post evaluator, post generator, post evaluator again, and it scores very close to 90. And then it says okay I need to go again and iterate over this. So it generates the post again. It does the evaluation again. You can see that now it's 83. After a few iterations something really interesting happened. Basically the agent decide that it was consistently getting a score in the 80s. So it decided to just finalize and then save the result. Finally the result was saved. Now this is not ideal because we still want to meet that 90 threshold. But what I found out is that it's really hard to actually get over 90. And so in a way you can argue that this is okay. But if you really want to be more strict, you should definitely instruct it here. It needs to be over 90. If it's not over 90 after like 10 iterations, then close the loop or something like that. You can put more conditions if you want. That's the power of having detailed instructions. So after that, it's just save the post and we can take a look at the post here. These are just the scores, but let me just show you the output here. And this post is related to the famous Antrophic blog post on AI agents. So definitely spicy. Antropic just dropped the nuclear take. Every dev needs to hear the dirty truth. your rap plus function calling not an agent that lchin monstrosity workflow pretending to be smart real agents equal systems that control their own execution flow but these are just the design patterns and then there's some reality check then hot take your intelligent system probably needs human in the loop not another abstraction layer that's funny who's ready to delete their overengineer agent stack and start fresh so a lot of really spicy takes here and I really like the output so far but definitely can be improved as I said this is just a first it situation showing you that you can do more with slash commands and sub agents inside of cloud code I hope you enjoyed this content. Let me know if you're interested in more videos like this below. And I'll be doing a full breakdown of all the agents and some other cool ideas for my Pro Academy members. So, I'll see you all soon.

Original Description

Learn how to build with AI Agents in my academy: [https://dair-ai.thinkific.com/](https://dair-ai.thinkific.com/) Use code YOUTUBE20 to get an extra 20% off. --- Building a self-improving agentic system with Claude Code sub agents and / commands. #claude #ai #tech #coding
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Elvis Saravia · Elvis Saravia · 0 of 60

← Previous Next →
1 101 ways to solve search (by Pratik Bhavsar)
101 ways to solve search (by Pratik Bhavsar)
Elvis Saravia
2 TLDR Generation of Scientific Documents | ML Interview #1 with Isabel Cachola
TLDR Generation of Scientific Documents | ML Interview #1 with Isabel Cachola
Elvis Saravia
3 Sentiment Analysis: Key Milestones, Challenges and New Directions
Sentiment Analysis: Key Milestones, Challenges and New Directions
Elvis Saravia
4 Discriminative Adversarial Search for Abstractive Summarization (by Thomas Scialom)
Discriminative Adversarial Search for Abstractive Summarization (by Thomas Scialom)
Elvis Saravia
5 Question Understanding: COVID-Q: 1,600+ Questions about COVID-19
Question Understanding: COVID-Q: 1,600+ Questions about COVID-19
Elvis Saravia
6 Getting Started with NLP
Getting Started with NLP
Elvis Saravia
7 Building tools and frameworks for large-scale social media mining (by Dr. Juan M. Banda)
Building tools and frameworks for large-scale social media mining (by Dr. Juan M. Banda)
Elvis Saravia
8 TextAttack: A Framework for Data Augmentation and Adversarial Training in NLP
TextAttack: A Framework for Data Augmentation and Adversarial Training in NLP
Elvis Saravia
9 Dive into Deep Learning (Study Group): Introduction to Deep Learning | Session 1
Dive into Deep Learning (Study Group): Introduction to Deep Learning | Session 1
Elvis Saravia
10 Dive into Deep Learning (Study Group): Multilayer Perceptrons | Session 4
Dive into Deep Learning (Study Group): Multilayer Perceptrons | Session 4
Elvis Saravia
11 How I read and annotate ML papers
How I read and annotate ML papers
Elvis Saravia
12 Keep Learning ML  (Session 1) | DSV, CompLex, Modern tools for emotions
Keep Learning ML (Session 1) | DSV, CompLex, Modern tools for emotions
Elvis Saravia
13 Dive into Deep Learning (Study Group): Preliminaries | Session 2
Dive into Deep Learning (Study Group): Preliminaries | Session 2
Elvis Saravia
14 Keep Learning ML #2 | Language-conditioned policy learning, Effective ML Testing, EagerPy
Keep Learning ML #2 | Language-conditioned policy learning, Effective ML Testing, EagerPy
Elvis Saravia
15 Dive into Deep Learning (Study Group): Linear Neural Networks | Session 3
Dive into Deep Learning (Study Group): Linear Neural Networks | Session 3
Elvis Saravia
16 Dive into Deep Learning (Study Group): Multilayer Perceptrons | Session 4
Dive into Deep Learning (Study Group): Multilayer Perceptrons | Session 4
Elvis Saravia
17 Keep Learning ML #3 | Contrastively Trained Structured World Models
Keep Learning ML #3 | Contrastively Trained Structured World Models
Elvis Saravia
18 Dive into Deep Learning (Study Group): Deep Learning Computation with PyTorch |  Session 5
Dive into Deep Learning (Study Group): Deep Learning Computation with PyTorch | Session 5
Elvis Saravia
19 Dive into Deep Learning (Study Group): Convolutional Neural Networks | Session 6
Dive into Deep Learning (Study Group): Convolutional Neural Networks | Session 6
Elvis Saravia
20 Dive into Deep Learning (Study Group): Modern CNNs | Session 7
Dive into Deep Learning (Study Group): Modern CNNs | Session 7
Elvis Saravia
21 101 ways to solve neural search with Jina
101 ways to solve neural search with Jina
Elvis Saravia
22 (Hopefully-Reusable) Life Lessons for PhD Students in NLP
(Hopefully-Reusable) Life Lessons for PhD Students in NLP
Elvis Saravia
23 How to save the world and forward your career in 5 easy steps | Women in NLP Talks
How to save the world and forward your career in 5 easy steps | Women in NLP Talks
Elvis Saravia
24 Prompt Engineering Overview
Prompt Engineering Overview
Elvis Saravia
25 Getting Started with the OpenAI Playground
Getting Started with the OpenAI Playground
Elvis Saravia
26 LM-Guided Chain of Thought
LM-Guided Chain of Thought
Elvis Saravia
27 Elements of a Prompt
Elements of a Prompt
Elvis Saravia
28 Reasoning with Intermediate Revision and Search with LLMs #chatgpt #ai #llms #science #programming
Reasoning with Intermediate Revision and Search with LLMs #chatgpt #ai #llms #science #programming
Elvis Saravia
29 General Tips for Designing Prompts
General Tips for Designing Prompts
Elvis Saravia
30 Efficient Infinite Context Transformers #ai #machinelearning #research #llms #science
Efficient Infinite Context Transformers #ai #machinelearning #research #llms #science
Elvis Saravia
31 Best Practices and Lessons Learned on Synthetic Data for Language Models #ai #machinelearning #genai
Best Practices and Lessons Learned on Synthetic Data for Language Models #ai #machinelearning #genai
Elvis Saravia
32 Reducing Hallucinations in Structured Outputs via RAG #chatgpt #ai #llms #programming
Reducing Hallucinations in Structured Outputs via RAG #chatgpt #ai #llms #programming
Elvis Saravia
33 Basic Prompt Examples for LLMs
Basic Prompt Examples for LLMs
Elvis Saravia
34 LLM In Context Recall is Prompt Dependent  #llms #ai #chatgpt #machinelearning
LLM In Context Recall is Prompt Dependent #llms #ai #chatgpt #machinelearning
Elvis Saravia
35 Zero-shot Prompting Explained
Zero-shot Prompting Explained
Elvis Saravia
36 RAG Faithfulness #llms #ai #gpt4
RAG Faithfulness #llms #ai #gpt4
Elvis Saravia
37 Understanding LLM Settings
Understanding LLM Settings
Elvis Saravia
38 Llama 3 is here! | First impressions and thoughts
Llama 3 is here! | First impressions and thoughts
Elvis Saravia
39 Llama 3 is Here! #ai #llms #llama3
Llama 3 is Here! #ai #llms #llama3
Elvis Saravia
40 Microsoft introduces Phi-3 | The most capable small language model?
Microsoft introduces Phi-3 | The most capable small language model?
Elvis Saravia
41 Microsoft introduces Phi-3! #ai #llms #microsoft
Microsoft introduces Phi-3! #ai #llms #microsoft
Elvis Saravia
42 Make Your LLM Fully Utilize the Context #ai #llms #machinelearning
Make Your LLM Fully Utilize the Context #ai #llms #machinelearning
Elvis Saravia
43 When to Retrieve? #ai #llms #machinelearning
When to Retrieve? #ai #llms #machinelearning
Elvis Saravia
44 Training an LLM to effectively use information retrieval
Training an LLM to effectively use information retrieval
Elvis Saravia
45 State-of-the-art open-source LLM judges #ai #machinelearning #gpt4
State-of-the-art open-source LLM judges #ai #machinelearning #gpt4
Elvis Saravia
46 Better and Faster LLMs via Multi-token Prediction
Better and Faster LLMs via Multi-token Prediction
Elvis Saravia
47 AlphaMath Almost Zero #ai #science #machinelearning
AlphaMath Almost Zero #ai #science #machinelearning
Elvis Saravia
48 SWE-Agent | An LLM-based Software Engineering Agent
SWE-Agent | An LLM-based Software Engineering Agent
Elvis Saravia
49 [LLM NEWS] AlphaFold 3, xLSTM, OpenAI's Model Spec, DeepSeek-V2, OpenDevin CodeAct 1.0
[LLM NEWS] AlphaFold 3, xLSTM, OpenAI's Model Spec, DeepSeek-V2, OpenDevin CodeAct 1.0
Elvis Saravia
50 LLM-powered tool for web scraping #ai #chatgpt #engineering
LLM-powered tool for web scraping #ai #chatgpt #engineering
Elvis Saravia
51 Learn about LLMs in this NEW course #ai #chatgpt #engineering
Learn about LLMs in this NEW course #ai #chatgpt #engineering
Elvis Saravia
52 [LLM NEWS] KANs, Gemma 10M Context, OpenAI Updates?, Automatic Prompt Engineering, Tokenizer Arena
[LLM NEWS] KANs, Gemma 10M Context, OpenAI Updates?, Automatic Prompt Engineering, Tokenizer Arena
Elvis Saravia
53 [LLM News] GPT4-o, Project Astra, Veo, Copilot+ PCs, Gemini 1.5 Flash, Chameleon
[LLM News] GPT4-o, Project Astra, Veo, Copilot+ PCs, Gemini 1.5 Flash, Chameleon
Elvis Saravia
54 Enhancing Answer Selection in LLMs #ai #machinelearning #engineering
Enhancing Answer Selection in LLMs #ai #machinelearning #engineering
Elvis Saravia
55 On exploring LLMs #ai #promptengineering #chatgpt
On exploring LLMs #ai #promptengineering #chatgpt
Elvis Saravia
56 Transformers Can Do Arithmetic with the Right Embeddings #ai #machinelearning #engineering
Transformers Can Do Arithmetic with the Right Embeddings #ai #machinelearning #engineering
Elvis Saravia
57 [LLM News] xAI Series B, Codestral, LLM Guide, AutoGen Course, Symbolic Chain-of-Thought
[LLM News] xAI Series B, Codestral, LLM Guide, AutoGen Course, Symbolic Chain-of-Thought
Elvis Saravia
58 PR-Agent #ai #gpt4 #software
PR-Agent #ai #gpt4 #software
Elvis Saravia
59 Extracting features from Claude 3 Sonnet
Extracting features from Claude 3 Sonnet
Elvis Saravia
60 Has prompt engineering been solved?
Has prompt engineering been solved?
Elvis Saravia

Learn how to build self-improving agentic systems with Claude Code sub agents and slash commands, and discover how to create evaluator-optimizer architectures for generating high-quality content. This video showcases a practical example of using AI agents for content generation and provides insights into optimizing LLM performance.

Key Takeaways
  1. Set up Claude Code and create sub agents
  2. Define evaluator and optimizer components
  3. Implement slash commands for custom workflows
  4. Test and refine the agentic system
  5. Optimize LLM performance for content generation
💡 Using an evaluator-optimizer architecture with sub agents and slash commands can help generate high-quality content with AI agents, but requires careful optimization and refinement to achieve desired results.

Related Reads

📰
I tested a new Debian Linux loaded with local AI - see if it's right for you
Learn about a new Debian Linux distribution loaded with local AI and decide if it's right for your needs
ZDNet
📰
Threads users can now chat with Meta AI in their DMs
Learn how to leverage Meta AI in Threads for enhanced user experience and why it matters for AI adoption in social media
TechCrunch AI
📰
Beyond RAG: Task-aware knowledge compression for enterprise AI on AWS
Learn to improve enterprise AI on AWS with task-aware knowledge compression, going beyond traditional RAG limitations
AWS Machine Learning
📰
Four Vectors, One Record: How I Split Embeddings Before They Hit Search
Learn how to split embeddings to improve search results by handling failure cases in production
Dev.to · Daniel Romitelli
Up next
5 Levels of AI Agents - From Simple LLM Calls to Multi-Agent Systems
Dave Ebbelaar (LLM Eng)
Watch →