Date: 2026-04-18
This document records the redesign decisions made while evaluating agentic-kit
against the comparable pi-mono architecture, especially packages/ai and
packages/agent.
agentic-kitremains the low-level provider portability layer.- Stateful orchestration moves into a separate
@agentic-kit/agentpackage. - Tool execution stays out of
agentic-kitcore; the core only models tools, tool calls, and tool results. @agentic-kit/agentv1 should be intentionally minimal, shipping only the sequential tool loop, lifecycle events, abort/continue, and pluggable context transforms. Steering/follow-up queues and richer interruption policies are deferred to phase 2.
- Core tool definitions use plain JSON Schema.
- TypeBox/Zod support stays as helper adapters, not the core contract.
- Core models are represented by a provider-independent
ModelDescriptorregistry with capability metadata. - The model registry must support both built-in descriptors and runtime registration of custom models/providers from day one.
- The core message model treats
imageinput andthinkingoutput as first-class content blocks in v1. usage,cost,stopReason, and abort-driven partial-result semantics are mandatory parts of the core contract in v1.
- Structured event streams become the primary streaming primitive; text-only chunk callbacks remain as convenience wrappers.
- Cross-provider replay and handoff is a hard requirement for v1, including normalization for reasoning blocks, tool-call IDs, aborted turns, and orphaned tool results.
- OpenAI-compatible backends should be handled by one generalized adapter path with compatibility flags, not many first-class provider packages.
- Embeddings stay out of the primary conversational core and live behind a separate optional capability interface or companion package.
agentic-kitshould ship a backward-compatibility layer for the currentgenerate({ model, prompt }, { onChunk })API for one transition release.
These decisions imply the following target architecture:
agentic-kitLow-level portability layer. Owns message/content types, model descriptors, provider registry, streaming event protocol, compatibility transforms, usage, and provider adapters.@agentic-kit/agentOptional stateful runtime. Owns tool execution, sequential loop semantics, lifecycle events, context transforms, and abort/continue behavior.- Separate optional capabilities or companion packages For non-conversational workloads such as embeddings, and optional schema helpers such as TypeBox/Zod integration.
- Keep the protocol portable and runtime-agnostic.
- Normalize provider differences in the core instead of leaking them upward.
- Treat OpenAI-compatible APIs as a compatibility class, not a brand-specific architecture.
- Avoid coupling the low-level layer to any single schema library or vendor SDK.
- Preserve a migration path from the existing text-only API while moving the real architecture to structured messages and events.