Principle 2: Code as the Universal Interface
Sarah had 3,000 photos from her trip across Southeast Asia. They were scattered across her phone, her camera, and a backup drive. The filenames were meaningless: IMG_4521.jpg, DSC_0089.jpg, Photo_2024_03_15.png. She wanted them organized by country and city, with dates in the filenames, duplicates removed.
She tried three different photo organization apps. Each did part of what she wanted, but none could handle her specific combination of requirements. The apps had pre-built features, and her needs did not fit those features exactly.
Then she asked a general agent for help. She described what she wanted. The agent wrote a small program that:
- Read the location data embedded in each photo
- Figured out which country and city it was taken in
- Renamed the files with proper dates
- Detected duplicates by comparing actual image content
- Organized everything into a clean folder structure
Fifteen minutes later, her photos were perfectly organized in exactly the way she wanted.
This is Principle 2 in action. The general agent succeeded where specialized apps failed because it could write code. Code became the interface through which the agent could do anything Sarah needed, not just what some app designer anticipated.
Why General Agents That Write Code Win
Here is what Anthropic discovered when they released Claude Code. People were not just using it to write software. They were using it to:
- Manage todo lists
- Organize files
- Analyze spreadsheets
- Sort through emails
- Automate repetitive tasks
This led to a fundamental insight: general agents that write code can solve any computational problem. Code is not just for programmers. Code is the universal interface through which agents interact with computers.
Think about what this means. A specialized "photo organizer" tool can only do what its creators built into it. Ten features, maybe twenty. If your needs do not match those features, you are stuck.
But a general agent that writes code has no such limits. Whatever you can describe, it can build. Your specific situation, your exact requirements, your unique combination of needs. The agent writes code that fits your problem precisely.
The Specialist Trap
Imagine you need work done on your house. The traditional approach is to call specialists:
- Leaky faucet? Call a plumber
- Broken light? Call an electrician
- Squeaky door? Call a carpenter
Each specialist is good at their one thing. But this approach has problems:
- You need to know which specialist to call
- If your problem spans two areas, you are coordinating between experts
- If you have a truly novel problem, you might not find anyone who can help
Early approaches to building helpful software worked the same way. A "research agent" for gathering information. A "finance agent" for calculations. A "writing agent" for content. Each one limited to its pre-built capabilities.
The General Agent Advantage
Now imagine a different approach. Instead of specialists, you have one skilled problem-solver who can build tools for any job:
- Need to fix the faucet? They craft the right solution
- Need to repair the light? They figure it out
- Need something that combines plumbing and electrical work? No problem
This is what a general agent does when it writes code. Instead of selecting from pre-built features, it writes solutions. Instead of being limited to what designers anticipated, it creates what you actually need.
Sarah's photo organization worked because the agent was not constrained by pre-built features. It wrote code that handled her exact situation:
- Photos from multiple devices
- Needing country-level organization
- With duplicate detection based on actual image content, not just filenames
The Five Powers of Code
Why is code such an effective interface for agents? Because code gives agents five distinct powers that nothing else provides.
Power 1: Precise Thinking
Watch what happens when you ask a general agent to calculate something complex. If it tries to reason through the calculation in words, it might make mistakes. Language is fuzzy:
- "About 30%" could mean 28% or 32%
- "A few hundred" could mean 200 or 500
But when the agent writes code to do the calculation, something changes. The code executes with perfect precision. 127 times 89 always equals 11,303. No approximation, no drift, no fuzzy thinking.
Story: The Budget Analysis
Marcus needed to analyze his small business expenses. He had a year of transactions and wanted to know:
- Average monthly spending by category
- Which months had unusual spikes
- How spending compared quarter over quarter
If he just asked for "a summary," the results would be vague. But the general agent wrote code that processed every transaction precisely. It:
- Calculated exact averages down to the cent
- Identified months that were more than two standard deviations from the mean
- Produced quarter-by-quarter comparisons with specific percentages
The code did not approximate. It computed. That precision came from code being the interface between the agent's understanding and the computer's execution.
Power 2: Workflow Orchestration
Many tasks involve multiple steps. First do this, then check that, then based on the result, do something else. Traditional approaches handle these steps one at a time, with back-and-forth at each stage.
Code lets the agent write an entire workflow at once. All the steps, all the conditions, all the logic, captured together. Then the whole thing runs smoothly from start to finish.
Story: The Job Application Tracker
Priya was applying for jobs and losing track of:
- Where she had applied
- When she needed to follow up
- Which applications were still active
She had information scattered across emails, a spreadsheet, and various job site accounts.
She described her situation to a general agent. The agent wrote code that:
- Scanned her emails for application confirmations
- Checked her spreadsheet for manual entries
- Looked up each company to see if the job posting was still active
- Calculated days elapsed since each application
- Generated a prioritized list of follow-ups needed
This was not one simple task. It was a workflow with multiple data sources, conditional logic, and calculated outputs. Code let the agent orchestrate all of it as a coherent whole.
Power 3: Organized Memory
Agents often need to work with lots of information:
- Documents and data
- Intermediate results
- Context from earlier steps
How do they keep track of it all?
File systems provide the answer. The agent can create files to store information, read files to retrieve it, search through files to find what it needs, and organize files into meaningful structures.
Story: The Research Project
David was researching electric vehicles for a major purchase decision. He wanted to compare:
- Range and charging speed
- Price and reliability ratings
- Owner satisfaction
Across a dozen different models.
A general agent helped by:
- Gathering information from multiple sources
- Saving each piece to organized files
- Cross-referencing the data to build comparison tables
- Generating a final report that pulled everything together
The agent created folders for each car model, files for different types of data, and summary documents. Without file system access, the agent would have struggled to manage all that information. With it, the agent had organized memory that persisted across the entire research process.
Power 4: Universal Compatibility
Different systems store data in different formats:
- Spreadsheets
- Databases
- PDFs
- Web pages
- Specialized file types
Different services have different ways of being accessed. This fragmentation could make integration impossible.
But code can read any format, transform any data, and connect to any service. Code serves as a universal translator between systems that were never designed to work together.
Story: The Event Planning Merge
Aisha was planning a large family reunion. She had:
- Guest information in a spreadsheet
- Dietary restrictions in email threads
- RSVP responses from a web form
- Flight itineraries in PDF attachments
A general agent needed to bring all of this together. The agent wrote code that:
- Read the spreadsheet for guest names and contact info
- Parsed the emails for dietary notes
- Pulled data from the web form for RSVPs
- Extracted arrival times from the PDFs
- Merged everything into a unified guest list with all relevant details
No single tool was designed to handle this combination of sources. But code could interface with all of them, making the agent universally compatible.
Power 5: Instant Tool Creation
Sometimes you need a custom tool that does not exist:
- A specific calculation for your situation
- A particular way of processing your data
- A unique automation for your workflow
Code lets agents create these tools on demand. You describe what you need, the agent writes code, and suddenly you have a tool that does exactly that thing.
Story: The Custom Report
Jin managed a community garden and needed to track:
- Plot assignments
- Water usage
- Harvest yields
- Volunteer hours
No garden management app did quite what he needed. Commercial tools were either too simple or too complex.
A general agent built Jin exactly what he needed. Code that:
- Tracked his specific data points
- Calculated the metrics he cared about
- Generated weekly reports in the format that worked for his community newsletter
The agent did not find an existing tool. It created one. That is the power of code as an interface. Anything you can describe, the agent can build.
What This Means for You
Understanding this principle changes how you work with general agents.
Describe What You Want, Not How to Do It
Your job is to be clear about what you need. The agent's job is to figure out how to accomplish it through code.
| Less Effective | More Effective |
|---|---|
| "Can you write a Python script that uses the os module to walk through directories and rename files?" | "I have 500 files with random names. I want them renamed to include the date they were created, in the format YYYY-MM-DD, followed by the original name." |
The second version focuses on the outcome you want. It gives the agent freedom to write whatever code accomplishes that goal.
Be Specific About Your Situation
The more precisely you describe your situation, the better the agent can tailor the solution.
Vague:
"Organize my files."
Specific:
"I have files in three folders: Downloads, Desktop, and Documents. I want all PDFs moved to a folder called 'PDFs', all images to 'Images', and all spreadsheets to 'Spreadsheets'. Files older than one year should go into an 'Archive' subfolder within each category."
Specific descriptions help agents write code that fits your exact needs.
Trust the Process
When a general agent writes code to solve your problem, you do not need to understand every line. What matters is whether the result matches what you wanted.
The collaboration loop works like this:
- You describe what you want
- The agent writes code to accomplish it
- You verify the results
- You refine if something is not quite right
If something is wrong, describe what you expected versus what you got. The agent will adjust the code.
The Bigger Picture
This principle connects to the core thesis of this book. General agents are powerful because they are not limited to pre-built capabilities. They can write code to solve any computational problem.
Code is the universal interface between agents and computers. Through code, agents can:
| Power | What It Enables |
|---|---|
| Precise Thinking | Exact calculations without fuzzy approximations |
| Workflow Orchestration | Multi-step processes that run smoothly |
| Organized Memory | Persistent storage across complex tasks |
| Universal Compatibility | Working with any format or system |
| Instant Tool Creation | Custom solutions built on demand |
This is why "all agents will become coding agents," as Davis Treybig observed. Specialized agents with fixed features will always be limited. General agents that write code can do anything.
In the next lesson, we will explore Principle 3: Verification as a Core Step. Because when agents write code to solve problems, checking that the code actually did what you wanted becomes essential. The power of code demands the discipline of verification.
Try With AI
Prompt 1: See the General Agent Advantage
I want to understand why general agents that write code are more powerful than specialized tools.
Here is my situation: I have a folder with hundreds of receipts. Some are photos from my phone, some are PDFs from email, and some are screenshots. I need to:
1. Extract the date and amount from each receipt
2. Categorize them (groceries, dining, transportation, etc.)
3. Create a monthly summary showing totals by category
4. Flag any unusually large purchases
Walk me through how you would approach this. Do not write actual code, since I am still learning. Instead, explain:
- What different steps would you take?
- How does this approach give you flexibility that a pre-built receipt app would not have?
- Which of the Five Powers are you using?
What you are learning: You are seeing how a general agent thinks about solving a problem. Notice how the agent can handle your specific combination of requirements rather than forcing you to fit pre-built features.
Prompt 2: Experience the Five Powers
I want to understand the Five Powers that code gives to general agents.
Pick an everyday task: planning a dinner party for 12 people with various dietary restrictions.
Show me how each power would help you handle this task:
1. **Precise Thinking:** How would code help calculate quantities and portions exactly?
2. **Workflow Orchestration:** What multi-step process would you create?
3. **Organized Memory:** How would files help track all the details?
4. **Universal Compatibility:** What different formats or sources might you need to work with?
5. **Instant Tool Creation:** What custom mini-tools might you build?
Help me see that these powers are not about programming. They are about what becomes possible when an agent can write code to solve problems.
What you are learning: You are experiencing how each power contributes to solving real problems. The dinner party is not a "coding task," but a general agent can handle it beautifully through these five powers.
Prompt 3: Practice Describing Problems
Help me practice describing problems in ways that help you write effective solutions.
I will give you three vague requests. For each one, help me make it specific enough that you could write code to solve it.
Request 1: "Help me manage my passwords better."
Request 2: "I want to read more books this year."
Request 3: "Keep track of my exercise."
For each request:
- Point out what is vague or ambiguous
- Ask me questions that would make it specific
- Show me what a clear, specific version would look like
Then explain how the specific version helps you write better code.
What you are learning: You are developing the skill of clear problem description. This is your main contribution to the human-agent collaboration. The clearer you describe what you want, the better code the agent can write to achieve it.
Summary
General agents are powerful because they write code. Code is the universal interface through which agents interact with computers to accomplish any task.
This principle explains why specialized tools with pre-built features will always be limited. A photo organizer app can only do what its designers built in. But a general agent can write whatever solution your specific situation requires.
Code gives agents five powers:
- Precise Thinking through exact calculations
- Workflow Orchestration through multi-step programs
- Organized Memory through file systems
- Universal Compatibility through the ability to work with any format
- Instant Tool Creation through writing custom solutions on demand
Your role in working with general agents is to describe what you want clearly and specifically. Focus on outcomes, not methods. Be precise about your situation. Then verify that the results match your intentions.
"All agents will become coding agents." This is not a prediction. It is already happening. Understanding why prepares you for a world where the most capable help comes from agents that can write code to solve any problem you bring them.