Definition

Claude Enterprise AI architecture is a software framework for deploying Anthropic's models in production environments. It focuses on Agentic Runtimes—host processes (Node.js, Python, or CLI) that manage model calls, tool execution, and state persistence.

It transitions from probabilistic "chat" to deterministic, code-governed workflows using the Model Context Protocol (MCP) and SDK-level guardrails.


Architectural Patterns

Hub-and-Spoke (Coordinator-Subagent)

The Hub-and-Spoke pattern is an orchestration strategy where one "Coordinator" agent manages specialized "Subagents."

  • The Coordinator: A primary model instance (e.g., Claude 3.5 Sonnet) running in a host process with a system prompt defining it as a manager. It does not perform technical work; it decomposes goals into tool calls.
  • The Subagents: Specialized model instances (often Claude 3 Haiku for speed/cost) invoked by the Coordinator via Tool Calling.
  • Implementation Example: In an automated PR review system, the Coordinator calls the Review_Security subagent and the Check_Styling subagent as if they were functions.
  • Runtime Context: This typically runs in a Headless Runtime (e.g., a Node.js worker on Cloud Run) or via a CLI (e.g., claude -p "Review this PR") in non-interactive mode.

Agentic Loops and stop_reason

Reliable agents use a state-machine loop governed by the model's stop_reason metadata.

  1. Call: The host process sends a message to Claude.
  2. Tool Use: If Claude returns stop_reason: "tool_use", the host process must execute the requested code locally.
  3. Result: The host process sends the tool result back to Claude.
  4. End: The loop exits only when stop_reason: "end_turn".
  • Tooling: This is implemented using the messages.create loop in the Anthropic SDK.

Scratchpad Pattern

Agents manage long-context state by writing to a persistent "Scratchpad" file.

  • Context: Prevents "forgetting" in 200k+ token windows by storing key facts in a dedicated file (e.g., investigation-status.md).
  • Tooling: The agent is provided with readFile and writeFile tools to update its own state independently of the conversation history.

Integration and MCP

Model Context Protocol (MCP)

MCP is an open standard for connecting Claude to external systems via stdio or HTTP servers.

  • The MCP Server: A standalone process (e.g., a Docker container or a local Node.js script) that exposes tools, resources, and prompts.
  • The MCP Client: An Agentic Runtime (like Claude Desktop or Claude Code) that connects to the server to consume its capabilities.
  • Example: An MCP server for GitHub allows a headless agent to create_issue or list_pull_requests using a standardized JSON-RPC interface.

Context Hierarchy (CLAUDE.md)

Context instructions are consumed by tools like claude-code to enforce local rules.

  • Project Level (/CLAUDE.md): Defines "Always use TypeScript," "Never use any," or "Run npm test before finishing."
  • Systemic Use: When a developer or a headless CI script launches Claude, the agent reads these files first to align its behavior with the specific codebase.

Security and Guardrails

Deterministic Enforcement (Hooks)

Safety is enforced through Middleware Hooks in the SDK, ensuring rules are enforced by code, not by prompts.

  • PreToolUse Hook: A TypeScript function in the host process that inspects a tool call (e.g., process_payment) and blocks it if it violates logic (e.g., amount > user_balance).
  • PostToolUse Hook: A function that scrubs tool outputs. Example: Using Microsoft Presidio to remove PII from a database result before the model sees it.

Prompt Engineering for Scale

Validation-Retry Loops

To prevent structured data failures, the host process enforces a schema (e.g., Zod or Pydantic).

  • Workflow: If the model returns invalid JSON, the host process catches the error and sends it back: "Error: 'price' must be a number." The model then self-corrects.

Position-Aware Prompting

Instructions are placed at the very beginning (pre-fill) or very end of the message.

  • Use Case: In long-context technical audits, placing the "Summary Format" at the end of the prompt ensures the model adheres to it despite processing 100k tokens of source code.

Examples and Tools

  • Runtime: Node.js, Python, Claude Code (CLI).
  • SDK: Anthropic TypeScript SDK, Claude Agent SDK.
  • Protocols: MCP (stdio servers).
  • Evaluation: Braintrust, LangSmith (for measuring "Pass@1" accuracy).