An Agent Framework Hiding Inside a Session: Dynamic Profiles in Foundation Models
Dynamic Profiles turn one LanguageModelSession into a declarative agent runtime: per-phase models, history transforms, and two orchestration patterns.
Writing about AI Engineering and Software Development.
Dynamic Profiles turn one LanguageModelSession into a declarative agent runtime: per-phase models, history transforms, and two orchestration patterns.
Private Cloud Compute gives apps a 32K-context server model with reasoning and no API keys and makes the per-user daily quota a UI design problem.
WWDC26 turned Foundation Models into Swift's general LLM client: a rebuilt on-device model, a server model with no API keys, and the first real agent primitives.
Setting up a two-target SPM package, strict concurrency, and AsyncHTTPClient — the foundation for a CLI agent that never needs restructuring.
The biggest gains in AI agent performance come from the system around the model, not the model itself.
After nine posts building a Claude Code-style agent by hand in Swift, I opened up JetBrains Koog framework and realized how much of what I'd hand-rolled was already someone else's problem. Here's what the framework gave me for free, and what it changed about how I think about agents.
How we restructured Claude Code's CLAUDE.md files in a monorepo to cut 73% of always-loaded context without losing a single fact.
Swift actors for background execution — the one type that truly needs an actor, with notification injection before each API call.
A file-based task DAG with dependency resolution — durable planning that survives context compaction.
A three-layer compression strategy — micro-compaction, auto-compaction, and manual compaction — for infinite conversations.
Two-layer knowledge injection — cheap awareness in the system prompt, full skill bodies loaded on demand via tool results.
Context isolation through recursive agent loops — spawning child agents with restricted tool sets for focused subtasks.
A Codable todo system with validation constraints and nag reminders — giving the agent a structured notepad it writes for itself.
Dictionary-based tool dispatch, path sandboxing, and the read/write/edit file tools that let the agent work with code.
The agent loop that drives everything — how a single stopReason check turns an API client into an autonomous agent.