PeaBox Lab › PeaLang › Learn › Chapter 26 › Lesson 5

Part IV — Expert Production Engineering · Chapter 26 · Lesson 5 of 6 · 2 min read

Lesson 5: Embedded or Sidecar Integration

Lesson level: Expert

Purpose: An integration boundary is safe when authority, values, limits, transport, and failures are explicitly controlled.

Learning Objectives

5.1 Concepts

Choose a supported execution boundary: Python embedding for a controlled in-process host, or a runtime sidecar invoked by a Java or TypeScript client. A sidecar separates transport and process location but still needs authenticated access, bounded requests, least privilege, and approved artifacts. Validate values in both directions and keep host objects, credentials, and final enforcement outside the script.

5.2 Annotated Example

RuntimeOptions.safe_defaults supplies an empty permission set and denies process execution. Configure only the explicit capabilities and limits required by the capstone. Expose small registered host functions rather than a database connection or unrestricted reflection. For a sidecar, pin client/server versions and run equivalent portable-value fixtures; an HTTP endpoint is not automatically an authenticated production boundary.

5.3 Guided Practice

Compare latency, isolation, deployment coupling, failure handling, and data exposure for embedding and sidecar choices. State which differences affect the threat model.

5.4 Common Mistakes

Do not expose an internal sidecar directly to untrusted callers, pass raw host objects, infer universal client compatibility, or reuse one mutable runtime across tenants without isolation review.

5.5 Hands-On Lab

Deliverable: Tested adapter or deployment, versioned configuration, observability evidence, and recovery runbook.

5.6 Review Questions

What does safe_defaults deny? Why must returned values be validated? Which additional controls does a sidecar require?

5.7 Applied Challenge

Add a second supported client adapter and prove the same contract without changing the policy module.

Lesson Summary

An integration boundary is safe when authority, values, limits, transport, and failures are explicitly controlled.

Lesson status: Draft complete; ready for review.

← Previous Next →