---
title: "Use Dynamic Profiles as the pack"
lesson_id: "04"
---

# Use Dynamic Profiles as the pack

- **Lesson ID:** 04
- **Goal:** Put packed slices into one active Dynamic Profile with a lossless history transform.
- **Human lesson:** [04-dynamic-profiles-as-the-pack.html](04-dynamic-profiles-as-the-pack.html)

## Prerequisites

- Lesson 03 pack.
- WWDC26 Dynamic Profiles idea: one active Profile.

## Inputs, outputs, and artifacts

- **Inputs:** Packed slices and allow-listed tools.
- **Outputs:** A DynamicProfile body the session can run.

## Agent build steps

1. Conform a struct to `LanguageModelSession.DynamicProfile`.
2. Put instructions and packed slice text in one Profile.
3. Attach only packed tools.
4. Use `historyTransform` for per-request trims, not a global history wipe.
5. State that one Profile is active.

## Constraints

Illustrative Swift. Cite [WWDC26 241](https://developer.apple.com/videos/play/wwdc2026/241/)/[WWDC26 242](https://developer.apple.com/videos/play/wwdc2026/242/) lightly. No LangChain. No em dashes.

## Key concepts

- A `DynamicProfile` body re-evaluates on each prompt and picks one `Profile`.
- Put packed slices in `Instructions` and attach only the packed tools.
- `historyTransform` trims what this request sees without mutating shared history.
- One active Profile per turn.

## Takeaways

- Prefer `historyTransform` for per-request trims.
- Extra tools inflate schema and invite extra calls.
- Model choice is a modifier on the Profile, covered in the router course.

## Acceptance checks

- One active Profile is explicit.
- historyTransform is lossless versus shared history.
- Agent brief link is present.
