Skip to content

Commit e1096c5

Browse files
authored
Merge pull request #4 from constructive-io/feat/features-complete
Redesign `agentic-kit` core around structured streams and add minimal agent runtime
2 parents b22c8a3 + 6f5ab1c commit e1096c5

89 files changed

Lines changed: 18393 additions & 6979 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.json

Lines changed: 0 additions & 63 deletions
This file was deleted.

README.md

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,66 @@
1111
<a href="https://github.com/constructive-io/agentic-kit/blob/main/LICENSE"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/></a>
1212
</p>
1313

14-
A unified, streaming-capable interface for multiple LLM providers.
14+
A provider-portable LLM toolkit with structured streaming, model registries,
15+
cross-provider message normalization, and an optional stateful agent runtime.
1516

1617
## Packages
1718

18-
- **agentic-kit** — core library with provider abstraction and `AgentKit` manager
19+
- **agentic-kit** — low-level portability layer with model descriptors, registries, structured event streams, and compatibility helpers
20+
- **@agentic-kit/agent** — minimal stateful runtime with sequential tool execution and lifecycle events
1921
- **@agentic-kit/ollama** — adapter for local Ollama inference
2022
- **@agentic-kit/anthropic** — adapter for Anthropic Claude models
21-
- **@agentic-kit/openai** — adapter for OpenAI and OpenAI-compatible APIs
23+
- **@agentic-kit/openai**generalized adapter for OpenAI-compatible chat completion APIs
2224

2325
## Getting Started
2426

2527
```bash
2628
git clone git@github.com:constructive-io/agentic-kit.git
2729
cd agentic-kit
28-
yarn install
29-
yarn build
30-
yarn test
30+
pnpm install
31+
pnpm build
32+
pnpm test
3133
```
3234

3335
## Usage
3436

3537
```typescript
36-
import { createOllamaKit, createMultiProviderKit, OllamaAdapter } from 'agentic-kit';
38+
import { complete, getModel } from "agentic-kit";
3739

38-
const kit = createOllamaKit('http://localhost:11434');
39-
const text = await kit.generate({ model: 'mistral', prompt: 'Hello' });
40+
const model = getModel("openai", "gpt-4o-mini");
41+
const message = await complete(model!, {
42+
messages: [{ role: "user", content: "Hello", timestamp: Date.now() }],
43+
});
4044

41-
// Multi-provider
42-
const multi = createMultiProviderKit();
43-
multi.addProvider(new OllamaAdapter('http://localhost:11434'));
45+
console.log(message.content);
4446
```
4547

4648
## Contributing
4749

4850
See individual package READMEs for docs and local dev instructions.
51+
52+
## Testing
53+
54+
Default tests stay deterministic and local:
55+
56+
```bash
57+
pnpm test
58+
```
59+
60+
There is also a local-only Ollama live lane that does not hit hosted
61+
providers. The default root command runs the fast smoke tier:
62+
63+
```bash
64+
OLLAMA_LIVE_MODEL=qwen3.5:4b pnpm test:live:ollama
65+
```
66+
67+
Run the broader lane explicitly when you want slower behavioral coverage:
68+
69+
```bash
70+
OLLAMA_LIVE_MODEL=qwen3.5:4b pnpm test:live:ollama:extended
71+
```
72+
73+
The Ollama live script performs a preflight against `OLLAMA_BASE_URL` and exits
74+
cleanly if the local server or requested model is unavailable. If
75+
`nomic-embed-text:latest` is installed, the lane also exercises local embedding
76+
generation.

REDESIGN_DECISIONS.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Agentic Kit Redesign Decisions
2+
3+
Date: 2026-04-18
4+
5+
This document records the redesign decisions made while evaluating `agentic-kit`
6+
against the comparable `pi-mono` architecture, especially `packages/ai` and
7+
`packages/agent`.
8+
9+
## Scope and Package Boundaries
10+
11+
1. `agentic-kit` remains the low-level provider portability layer.
12+
2. Stateful orchestration moves into a separate `@agentic-kit/agent` package.
13+
3. Tool execution stays out of `agentic-kit` core; the core only models tools,
14+
tool calls, and tool results.
15+
4. `@agentic-kit/agent` v1 should be intentionally minimal, shipping only the
16+
sequential tool loop, lifecycle events, abort/continue, and pluggable context
17+
transforms. Steering/follow-up queues and richer interruption policies are
18+
deferred to phase 2.
19+
20+
## Core Type System
21+
22+
5. Core tool definitions use plain JSON Schema.
23+
6. TypeBox/Zod support stays as helper adapters, not the core contract.
24+
7. Core models are represented by a provider-independent `ModelDescriptor`
25+
registry with capability metadata.
26+
8. The model registry must support both built-in descriptors and runtime
27+
registration of custom models/providers from day one.
28+
9. The core message model treats `image` input and `thinking` output as
29+
first-class content blocks in v1.
30+
10. `usage`, `cost`, `stopReason`, and abort-driven partial-result semantics are
31+
mandatory parts of the core contract in v1.
32+
33+
## Streaming and Conversation Semantics
34+
35+
11. Structured event streams become the primary streaming primitive; text-only
36+
chunk callbacks remain as convenience wrappers.
37+
12. Cross-provider replay and handoff is a hard requirement for v1, including
38+
normalization for reasoning blocks, tool-call IDs, aborted turns, and
39+
orphaned tool results.
40+
41+
## Provider Strategy
42+
43+
13. OpenAI-compatible backends should be handled by one generalized adapter path
44+
with compatibility flags, not many first-class provider packages.
45+
14. Embeddings stay out of the primary conversational core and live behind a
46+
separate optional capability interface or companion package.
47+
48+
## Migration Strategy
49+
50+
15. `agentic-kit` should ship a backward-compatibility layer for the current
51+
`generate({ model, prompt }, { onChunk })` API for one transition release.
52+
53+
## Architectural Implications
54+
55+
These decisions imply the following target architecture:
56+
57+
- `agentic-kit`
58+
Low-level portability layer. Owns message/content types, model descriptors,
59+
provider registry, streaming event protocol, compatibility transforms, usage,
60+
and provider adapters.
61+
- `@agentic-kit/agent`
62+
Optional stateful runtime. Owns tool execution, sequential loop semantics,
63+
lifecycle events, context transforms, and abort/continue behavior.
64+
- Separate optional capabilities or companion packages
65+
For non-conversational workloads such as embeddings, and optional schema
66+
helpers such as TypeBox/Zod integration.
67+
68+
## Design Principles Confirmed
69+
70+
- Keep the protocol portable and runtime-agnostic.
71+
- Normalize provider differences in the core instead of leaking them upward.
72+
- Treat OpenAI-compatible APIs as a compatibility class, not a brand-specific
73+
architecture.
74+
- Avoid coupling the low-level layer to any single schema library or vendor SDK.
75+
- Preserve a migration path from the existing text-only API while moving the
76+
real architecture to structured messages and events.

apps/tanstack-chat-demo/.cta.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"projectName": "tanstack-chat-demo",
3+
"mode": "file-router",
4+
"typescript": true,
5+
"tailwind": true,
6+
"packageManager": "pnpm",
7+
"git": false,
8+
"install": false,
9+
"addOnOptions": {},
10+
"includeExamples": false,
11+
"envVarValues": {},
12+
"routerOnly": false,
13+
"version": 1,
14+
"framework": "react",
15+
"chosenAddOns": []
16+
}

apps/tanstack-chat-demo/.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
node_modules
2+
.DS_Store
3+
dist
4+
dist-ssr
5+
*.local
6+
.env
7+
.nitro
8+
.tanstack
9+
.wrangler
10+
.output
11+
.vinxi
12+
__unconfig*
13+
todos.json
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"files.watcherExclude": {
3+
"**/routeTree.gen.ts": true
4+
},
5+
"search.exclude": {
6+
"**/routeTree.gen.ts": true
7+
},
8+
"files.readonlyInclude": {
9+
"**/routeTree.gen.ts": true
10+
}
11+
}

0 commit comments

Comments
 (0)