Chapter 05 of 14 · Part 2: Build Your First Agent

Chapter 5: Prototyping in the Console — The No-Code Way In

By the end of this chapter, you will know how to use Anthropic's Console and the ant CLI to create and test an agent without writing a full application — and understand when to prototype before committing to code.


The Big Idea

The fastest path to a working agent isn't writing code. It's using the tools Anthropic built for exploring and validating ideas before you commit to a full implementation.

Prototyping first saves you from the most expensive mistake in software development: building the wrong thing thoroughly. A prototype tells you whether your system prompt is working, whether your tool selection makes sense, and whether the task you've defined is actually something an agent can handle — before you've invested hours in backend infrastructure.

Claude Managed Agents gives you two lightweight entry points:

  1. The ant CLI — a command-line tool that lets you create agents, environments, and sessions with single commands
  2. The Anthropic Console — a web interface that includes session tracing, integration analytics, and troubleshooting guidance built in

You can get from zero to a running agent in under ten minutes using either. This chapter covers both.

Important note: The official "Prototype in Console" documentation page was not accessible at the time this book was written — it appears in the navigation but returned a 404. What follows is drawn from the Quickstart, the Overview, and confirmed CLI documentation. The Console UI capabilities are described based on what Anthropic has confirmed publicly.

DiagramSplit-screen mockup. Left side: terminal window showing `ant` CLI commands. Right side: Console web interface showing an agent session with event stream. Caption: "Two ways to prototype — pick the one you're comfortable with."

The Analogy

Prototyping an agent before building the full application is like staging furniture in an empty room before you renovate.

You could dive straight into construction — tear out walls, wire the outlets, lay the floor. But if the layout doesn't work for how you live, you've wasted significant effort.

Staging first costs almost nothing. Move a few pieces of furniture in, live with the layout for a day, spot the problems. Then renovate.

The ant CLI and the Console are your staging tools. Spin up an agent with a rough system prompt, send it a few test tasks, watch how it behaves. If the system prompt is too loose, tighten it. If the tools are wrong, swap them. If the task is more complex than expected, add instructions. All of this before a single line of production code.

DiagramTwo-panel illustration. Left: floor plan with furniture scattered randomly, labeled "Build first, discover problems later." Right: furniture being rearranged without tools, labeled "Stage first, then build." Key message: "Staging (prototyping) costs hours. Building costs days."

How It Actually Works

The ant CLI

The ant CLI is the official command-line tool for Claude Managed Agents. Every key operation — creating agents, creating environments, starting sessions, managing events — has a corresponding CLI command.

Setup:

# Check CLI installation
ant --version
# Set API key
export ANTHROPIC_API_KEY="your-api-key-here"

(Quickstart)

The CLI uses a beta: prefix for all Managed Agents commands, reflecting the product's public beta status. All commands follow the pattern ant beta:<resource> <action>.

Creating an agent:

ant beta:agents create \
  --name "Coding Assistant" \
  --model '{id: claude-opus-4-7}' \
  --system "You are a helpful coding assistant. Write clean, well-documented code." \
  --tool '{type: agent_toolset_20260401}'

This returns a JSON object with an id field (e.g., "agent_01HqR2k7vXbZ9mNpL3wYcT8f") and a version field. Save both.

Creating an environment:

ant beta:environments create \
  --name "quickstart-env" \
  --config '{type: cloud, networking: {type: unrestricted}}'

This returns an environment id. The unrestricted networking mode gives the container full outbound internet access.

Listing your resources:

# List all agents
ant beta:agents list

# List all environments
ant beta:environments list

These commands confirm your resources exist and return their IDs and statuses.

The Anthropic Console

The Console is the web interface at console.anthropic.com. According to confirmed reporting on the Managed Agents launch, the Console includes:

  • Session tracing — view the full event history of any session
  • Integration analytics — usage and performance data across your agents
  • Troubleshooting guidance — built-in tools for diagnosing session failures

For prototyping specifically, the Console is valuable for:

  1. Watching what the agent actually does in real time through the session trace
  2. Identifying where the agent gets confused or takes wrong actions
  3. Comparing behavior across different system prompt versions
  4. Reading the full event stream without writing streaming code

The Console won't replace code for production workloads, but for iteration and debugging it reduces the feedback loop significantly.

A Minimal Prototype Session (Python SDK)

Once you have an agent and environment, creating a prototype session and sending it a task requires about 20 lines of Python:

with client.beta.sessions.events.stream(session.id) as stream:
    # Send the user message after the stream opens
    client.beta.sessions.events.send(
        session.id,
        events=[
            {
                "type": "user.message",
                "content": [
                    {
                        "type": "text",
                        "text": "Create a Python script that generates the first 20 Fibonacci numbers and saves them to fibonacci.txt",
                    },
                ],
            },
        ],
    )

    # Process streaming events
    for event in stream:
        match event.type:
            case "agent.message":
                for block in event.content:
                    print(block.text, end="")
            case "agent.tool_use":
                print(f"\n[Using tool: {event.name}]")
            case "session.status_idle":
                print("\n\nAgent finished.")
                break

(Quickstart)

The key pattern: open the stream first, then send. The with block opens the SSE connection; anything you send inside the block is guaranteed to be observable. Sending before opening risks losing events that fire in the gap between send and listen.

What to Look for During Prototyping

When you watch a prototype session run, focus on four things:

  1. Is the agent going in the right direction immediately? After the first one or two steps, you can usually tell if the system prompt is working. If it starts doing something irrelevant, stop the session and revise the prompt.

  2. Which tools is it using? The agent.tool_use events tell you. If it's not using tools you expected, or using tools you didn't intend, that's a signal.

  3. Where does it hesitate or ask for clarification? If it frequently pauses with end_turn without completing work, the task description may be too vague.

  4. Does the final output meet your definition of "done"? Compare the output to what you'd accept from a skilled human doing the same task. If there are gaps, identify whether they're due to the task description, the system prompt, the model choice, or the tools available.

The Interactive Onboarding Option

The Quickstart docs note: "Prefer an interactive walkthrough? Run /claude-api managed-agents-onboard in the latest version of Claude Code for a guided setup and interactive question-answering." (Quickstart)

If you're already using Claude Code, this is the fastest way to get an interactive guided setup.

DiagramAnnotated terminal screenshot showing the `ant` CLI output from creating an agent. Callout boxes pointing to: (1) the `id` field in the JSON response — "Save this — you need it for session creation." (2) the `version` field — "Starts at 1. Increments on each update." (3) the `type: "agent"` field — "Confirms the object type."

Try it yourself

Try It Yourself

This walkthrough gets you to a running prototype end to end.

  1. Set up your CLI:

    ant --version
    export ANTHROPIC_API_KEY="your-api-key-here"
    
  2. Create a prototype agent:

    ant beta:agents create \
      --name "Prototype Agent" \
      --model '{id: claude-haiku-4-5-20251001}' \
      --system "You are a helpful assistant that can read and write files and search the web." \
      --tool '{type: agent_toolset_20260401}'
    

    Save the returned id. Call it $AGENT_ID.

  3. Create an environment:

    ant beta:environments create \
      --name "prototype-env" \
      --config '{type: cloud, networking: {type: unrestricted}}'
    

    Save the returned id. Call it $ENVIRONMENT_ID.

  4. Create a session and send a test task (Python):

    import anthropic
    client = anthropic.Anthropic()
    
    session = client.beta.sessions.create(
        agent="<your-agent-id>",
        environment_id="<your-environment-id>",
    )
    
    with client.beta.sessions.events.stream(session.id) as stream:
        client.beta.sessions.events.send(
            session.id,
            events=[{"type": "user.message", "content": [{"type": "text", "text": "Search the web for the current price of gold and write the result to a file called gold_price.txt"}]}],
        )
        for event in stream:
            match event.type:
                case "agent.message":
                    for block in event.content:
                        print(block.text, end="")
                case "agent.tool_use":
                    print(f"\n[Tool: {event.name}]")
                case "session.status_idle":
                    break
    
  5. Watch the output. Note which tools were used, what the agent wrote in its messages, and whether the final result met your expectation. This is the prototype feedback loop.

  6. Revise and retest. Change one thing — the system prompt, the task description, or the model — and run again. Keep notes on what changed and what improved.

DiagramThree-panel "iteration loop" diagram. Panel 1: "Run prototype" — arrow pointing right. Panel 2: "Observe events" — what tools were used, what was said, what was produced. Panel 3: "Revise" — system prompt, task, model, tools. Arrow looping back to Panel 1. Label: "Each loop takes minutes. Don't skip it."

Common pitfalls

Common Pitfalls

  • Skipping prototyping and going straight to production code. The system prompt is the most important thing you'll write for your agent. It takes iteration. Don't skip that iteration by building the full pipeline first.

  • Testing with only one task. Run at least five different test prompts that cover the range of inputs you expect in production. Edge cases surface during prototyping, not after launch.

  • Ignoring tool use patterns. If your agent isn't using the tools you expected, that's information. It might mean the task doesn't require them, or it might mean the system prompt isn't clear enough about what tools to reach for.

  • Using Opus for prototyping cost reasons. Counterintuitively, you might want to avoid Opus for prototyping — not because it's too capable, but because it's expensive for the rapid iteration you do during prototyping. Use Haiku or Sonnet for the iteration phase, then test your final prompt on the production model.

  • Not saving the agent and environment IDs. The ant CLI returns these at creation time. If you lose them, you'll need to run ant beta:agents list to recover them.


Toolkit

Toolkit

  • Prototype Evaluation Template — A structured observation log for recording what happened during each prototype session: tools used, key agent messages, output quality score (1–5), and one thing to change for the next iteration.

  • System Prompt Starter Library — Three starter system prompts for common agent types (coding assistant, research agent, data processing agent) that you can modify for your use case.


Chapter Recap

  • Prototyping before building saves time by catching system prompt issues, tool selection errors, and task definition problems before they're embedded in production code.
  • The ant CLI provides one-command creation for agents, environments, and sessions. The Console provides a web interface with session tracing and analytics.
  • The core prototype loop: create agent → create environment → start session → send test task → watch events → revise → repeat. Each iteration takes minutes. Don't skip it.