CertPrep
Domain 2 · Lesson 2.2 · 5 min read

The Application Boundary

Exam skillApplication Boundary and Surface Behavior

Evaluating an application design for how Claude interprets instructions on different surfaces, what content crosses the application boundary, and whether its schema and session decisions meet the stated requirements.

Design what crosses between your application and the model. Each surface (claude.ai, the API, Claude Code) frames Claude differently, so supply your own instructions; send only the data the task needs; keep sessions and history in your application, per user; validate what comes back before it reaches clients; and keep keys and confidential logic on the server.

What you need to know

Surfaces frame Claude differently

SurfaceWhat frames the model
claude.ai appsAnthropic's own system prompt, plus Projects, knowledge and memory features
Messages APIOnly what your request contains. No default system prompt, no tools, no files, no memory
Claude CodeIts own system prompt, tools, CLAUDE.md, settings and permissions
Cloud platforms (Bedrock, Vertex AI, Foundry)The same models, but feature availability can lag the first-party API

A prompt that worked in the chat app or in Claude Code can behave differently on the API because the framing is gone. State the role, tone, language and format your app needs, and provide tools and documents explicitly (or use the Agent SDK for a Claude Code-style harness).

What crosses the boundary

Everything in the request enters the model's context: system prompt, history, documents, tool results. Everything the model returns can reach your users. Design both directions.

  • Minimize inbound data. Send the fields a task needs, not the whole record. Look facts up in code and use Claude for language where possible. "Ignore the payment fields" does not reduce exposure.
  • Shape tool results. A tool that returns a full profile when the task needs a city puts personal data into context for nothing.
  • Keep secrets and confidential logic out of prompts. Anything in context can leak; apply pricing rules or business logic in backend code.
  • Treat outside content as data. Emails, uploads and web pages are untrusted; never place user-supplied text in the system prompt.
  • Validate outbound data. Use schemas and check results (citations, fields) before they reach the browser or another system.

Sessions and state

The Messages API stores nothing for you. Your application decides:

  • Where history lives (your database), for whom (one history per user or case, never shared), and for how long (a retention rule you can enforce and delete on).
  • What to resend each turn (the part of history the reply needs, often summarized).
  • Resuming on another device means loading the stored history; a session ID exists only in higher-level runtimes such as Managed Agents.

Schema decisions

If the front end needs exact fields, constrain the response with a JSON schema and validate it server-side. If a requirement says "every citation must be verifiable," ground answers in supplied documents and check citations before display.

In the exam

Items describe an application design and ask whether it meets a requirement (privacy, isolation, consistency, verifiability) or why behavior differs between surfaces. Prefer designs that minimize data, keep state and secrets in the backend, isolate users and validate output. Distractors rely on instructions to ignore data, client-side keys, API-side storage that does not exist, or shared prompts.

Check your understanding

Question 1

A prompt is friendly in claude.ai but plain on the API with no system prompt. Why?

Show answer

Answer: A. Each surface frames the model differently; the API sends only what you include.

Question 2

A health app sends the full patient record to answer "When is my next appointment?" What reduces exposure?

Show answer

Answer: B. Only data the task needs should cross the boundary.

Question 3

Users must resume chats on another device. What must the app do?

Show answer

Answer: D. The Messages API is stateless; the app owns history.

Apply it: Draw Larkspur's refill-assistant boundary

Exercise · about 20 minCase: Larkspur Pharmacy

Larkspur's mobile app will call the refill assistant. The assistant needs prescription status, can request refills, must never give dosing advice, and handles protected health information. The first prototype called the API from the app and sent the full patient profile with every message.

  1. Redraw the call path from app to Claude.
  2. List what crosses the boundary inbound and outbound, and what must not.
  3. Decide where history lives and for how long.
    Done when: the key, unneeded data and unvalidated output never cross.
Check your work
Show model answer

1. App to Larkspur backend (user authenticated), backend to Claude API. The backend holds the key, adds the system prompt, tools and per-user history, and applies rules.

2. Inbound: the user's message, recent history, and tool results limited to prescription name, status, refills left and pickup store. Never: full profile, address, payment data, the API key. Outbound: the reply text, checked for dosing content by a classifier step or rule before display; refill requests go through the refill tool, which validates supply length and logs an audit record.

3. In Larkspur's database, per patient, for 30 days, then deleted; only the last few turns plus a short summary are resent each time.

Key termsAmazon BedrockMessages APIPIISystem promptVertex AI

Sources