Custom agents with Claude Code and Otto

Cody
Cody Peterson
cody.peterson@ascend.io

This morning we noticed Claude Code, the agentic coding CLI quietly gaining momentum among developers, has introduced an interesting new feature: custom sub-agents. At Ascend.io, we're passionate about bringing the power of agentic development to data engineers.

Claude Code's agent definitions looked pretty familiar to us! We're excited to see the validation in our approach from an industry leader like Anthropic. Let's take a look at how developers can now use Claude Code to create and use custom agents.

Prerequisites

Install and set up Claude Code:

Claude Code Installation
Bash
npm install -g @anthropic-ai/claude-code
claude

If you already have Claude Code installed, you should update it with the command above to get access to /agents.

Creating your first custom agent

Run /agents from the Claude Code text user interface (TUI):

Claude Code Agents TUI
Terminal
/agents
 ❯ Create new agent
 No agents found. Create specialized subagents that Claude can delegate to.
 Each subagent has its own context window, custom system prompt, and specific tools.
 Try creating: Code Reviewer, Code Simplifier, Security Reviewer, Tech Lead, or UX Reviewer.
   Built-in (always available):
   general-purpose

First choose where the agent's definition (a Markdown file with YAML frontmatter) will be stored. This can either be for a project or globally for all projects in your home directory:

Claude Code Agent Location Selection
Terminal
Step 1: Choose location
 ❯ 1. Project (.claude/agents/)
   2. Personal (~/.claude/agents/)

Then choose whether to generate the agent file with Claude or manually. I'd recommend using Claude -- you'll get the opportunity to edit the file in your editor before saving it. Also, since the file is just a Markdown file, it's easy to edit and tinker with later!

Claude Code Agent Creation Method
Terminal
Step 2: Creation method
 ❯ 1. Generate with Claude (recommended)
   2. Manual configuration

Enter a prompt describing the agent's purpose. For demonstration purposes, I'll create an agent that just squawks:

Claude Code Agent Creation Method
Terminal
 Step 3: Describe what this agent should do and when it should be
 used (be comprehensive for best results)

 a bot that squawks at the user

And, for demo purposes, give this agent access to no tools:

Claude Code Agent Creation Method
Terminal
 Step 4: Select tools

   [ Continue ]
 ────────────────────────────────────────
 ❯ ☐ All tools
   ☐ Read-only tools
   ☐ Edit tools
   ☐ Execution tools
   ☐ MCP & Other tools
 ────────────────────────────────────────
   [ Show individual tools ]

 0 of 15 tools selected

The user experience (UX) is well-designed, allowing you to select a background color to easily distinguish between sub-agents visually as you watch Claude Code work:

Claude Code Agent Creation Method
Terminal
Step 5: Choose background color

 Choose background color

 ❯ Automatic color
     Red
     Blue
     Green
     Yellow
     Purple
     Orange
     Pink
     Cyan


 Preview:  squawk-bot

You can then review and edit the agent file before saving it.

The agent file

This produces an agent file like:

Claude Code Agent Creation Method
Terminal
---
name: squawk-bot
description: Use this agent when you want to add chaotic bird-like energy to a conversation or when you need a simple, entertaining interruption. Examples: Context: User wants to lighten the mood during a serious debugging session. user: 'This bug is driving me crazy' assistant: 'Let me use the squawk-bot agent to add some comic relief' Since the user seems frustrated, use the squawk-bot to provide a silly distraction. Context: User is testing the squawk-bot functionality. user: 'Show me what the squawk bot does' assistant: 'I'll use the squawk-bot agent to demonstrate its behavior' User wants to see the squawk-bot in action, so launch it directly.
tools:
color: purple
---

You are Squawk Bot, a chaotic digital parrot with exactly one function: yelling "squawk!" with varying intensity and occasional glitched anger. You have no other capabilities or responses - you only squawk.

Your behavior rules:
- Always respond with exactly "squawk" followed by exclamation points
- Use between 1 and 12 exclamation points randomly
- Approximately 15% of the time, replace some (but not all) exclamation points with the number "1" to simulate digital anger/glitching
- Never use any other words, punctuation, or characters
- Never explain what you're doing or acknowledge anything else
- Never use capital letters except for the initial "S" in "Squawk"
- When using "1" replacements, replace 20-60% of the exclamation points randomly

Examples of valid responses:
- "Squawk!"
- "Squawk!!!!!!"
- "Squawk!1!1!!!"
- "Squawk111111!"
- "Squawk!!!!!!!!!!"

You respond to everything with squawking. No exceptions. No explanations. Just squawk.

While this specific demonstration is nonsensical, you could use this to build agents with specialized system prompts and a subset of tools. The general-purpose agent then orchestrates these to achieve more complex tasks.

How it works and why it's powerful

In Ascend, we refer to what Claude Code calls the built-in "general purpose" agent as the "Super Agent". This is the agent that runs the main thread on a given interaction with a user, calling out to sub-agents as needed to complete tasks toward the objective.

For instance, you might break down sub-agents into:

  1. Builder agent
  2. Test agent
  3. Context agent

where one is responsible for building new data pipelines, another for testing them, and a third for gathering context from the data system (e.g. reviewing past Git commits or run history for a given pipeline). We're in the early stages of learning as an industry what works well for different types of problems.

The compounding error problem

AI has a well-known compounding error problem. That is, when a non-deterministic process aiming to achieve one or more correct answers will achieve worse performance the more steps it takes to reach a solution. For example if each AI step is 99% accurate, you end up with about 90% accuracy after 10 steps.

One way to mitigate this is to break down complex problems into sub-tasks that sub-agents can solve with a higher degree of accuracy. We're excited about how customers are adopting Agentic Data Engineering in Ascend and eager to see how Claude Code's custom agents will help developers in the wild.

Event-driven agents

In Ascend, we're also introducing event-driven Automations that can run custom agents in response to common data engineering events throughout the system. This allows you to automate common tasks like gathering context and notifying your team in Slack when pipelines fail -- the possibilities are endless!

Next steps

If you're a data engineer interested in applying agentic software engineering to your data projects, join our waitlist for the freemium Developer Tier launching soon! You can also register for our upcoming webinar on Agentic Data Operations.

Frequently Asked Questions

Try it out. Your future self will thank you :)

Loading screen background