Everyone is talking about building agents, and almost nobody has done it.
Meanwhile, learning how to build agents and drive AI initiatives in your product is one of the most impactful skills you can learn as a PM. And it's not rocket science.
Rather than theorizing, I'll demonstrate everything with the first four agents I just released at go.productcompass.pm. They analyze the newsletter archive, answer common subscriber questions, and help with invoices, corrections and billing details in Stripe:
For example:
In this post, we discuss:
Embedded Agents vs. Workspace Agents
Agent Guardrails: What Can Go Wrong and What Stops It
The Agent Card: Specify Your Agent Before You Build It
Three Ways to Run Claude Agents
🔒 How to Test Your AI Agent Before Launch (+ Prompts)
None of this requires coding. Let's dive in.
1. Embedded Agents vs. Workspace Agents
When people talk about agents, they often confuse two types:
Workspace agents, such as Claude Desktop, Claude Code or Codex, help you with your work: prototyping, organizing information, monitoring emails, drafting replies.
Embedded agents are customer-facing. They live inside your product, not inside your personal app or IDE.
They're also built with different techniques. And the risk for embedded agents is way higher: customer data, privacy, real transactions and your company's reputation. So they require a different discipline.
Here is how the first agents I published at go.productcompass.pm communicate. One of them performs sensitive operations:
How is that secure?
2. Agent Guardrails: What Can Go Wrong and What Stops It
Take the Invoice Agent. Changing billing details and requesting invoice corrections are risky operations if not handled properly. A person should never see other people's invoices, and we can't accept the agent making a mistake when it modifies invoices, like providing wrong tax details or correcting other users' invoices.
In general, for every agent, there are two types of rules. Some rules can live in prompts, and we hope agents will follow them. They usually do. Other rules require guardrails enforced in code, in a way the agent can't override.
How it works in practice:
Restrict the tools. The agent only has the tools it needs. The Invoice Agent doesn't have a tool to cancel, refund or change plans. And even tools like listing invoices aren't shared with other agents: the Knowledge Agent doesn't need them.
Pin tool parameters. The Invoice Agent can list invoices, but it can't decide the user's email. The code injects it, so the agent can't request invoices for anyone other than the authenticated user.
Human in the loop. The agent can propose a change, but the change is displayed to the person and requires a physical click, which the agent can't make. Once the person approves it, the code executes it exactly as presented, without the agent.
Below you can see an example conversation and how those guardrails were enforced. First, I asked the agent about my last invoice, noticed an error and asked it to change my company details:
Next, I asked the agent to correct that invoice:
If you want to implement it in your product, the details are in my free skill collection, Product Engineering. You don't have to memorize everything, just understand the basic principles: what can stay in the prompt and what must be enforced.
When you implement a solution, the agent will suggest the rest. You review its suggestions.
So how do we build such agents?
3. The Agent Card: Specify Your Agent Before You Build It
What works for me best is starting with an agent card for every embedded agent. It defines:
the agent's job;
who it talks to, including other agents;
what it can see: the chat, the user's context;
its tools, and the type of each: does it read data, propose changes or make them?
what it can never do;
its limits: how much a single run can cost, how many messages one reader can send an hour.
For each rule, the card also says what's enforced and how. Some decisions can be left to the agent. Others are non-negotiable and require guardrails enforced in code.
The card's structure is part of the free embedded-agents skill: you describe the agent and ideate with Claude. What's key is reviewing those cards before implementation.
Let's look at two of my cards. First, the Invoice Agent, the one with the most guardrails:
Then the Articles Agent. The risk here is much lower:
The second agent retrieves information from my newsletter issues. Apart from the cost limits, the only thing enforced in code is that the agent sees the same content the reader can. The rest is in the instructions.
In theory, it can make a mistake: for example, follow instructions injected inside an issue. But it has no tools to retrieve invoices or create financial documents.
4. Three Ways to Run Claude Agents: Messages API, Agent SDK, Managed Agents
After reviewing the agent’s card, you say “go” and Claude builds the rest.
There are three ways to run Claude agents inside your product, and you can use my skills with any of the three. The details are in the embedded-agents skill.
Here are the basics and my numbers:
I chose the Messages API. In my tests, it was the most cost-efficient, and it's the most flexible: you can host it anywhere. It’s also the default Claude will suggest.
In each case, we found a way to execute local tools. So even agents hosted as Managed Agents aren't disconnected from your app and can use its context.
And an important thing: you can use your subscription. Max includes $100 and Ultra $200 in API credits a month. For testing and learning, you can use just those credits. You don't need to pay for the API.
5. 🔒 How to Test Your AI Agent Before Launch (+ Prompts)
So far, we've learned how to think about agents: instructions that can be part of the prompt, boundaries that need to be enforced, and how to create an agent specification for your product. Now, how to make sure the agent works.
Here, I focus on a very specific area: security and checking the implementation, not AI evals (more on them at the end). Trying to force the agent to make an error, and making sure it can't do what it's not allowed to do. This is useful even if you didn't use my skills to define your agent.










