
Security News
RubyGems Adds Cooldown Feature to Bundler for Newly Published Gems
RubyGems and Bundler 4.0.13 introduced an opt-in cooldown feature that delays newly published gems during dependency resolution.
@agentick/apple
Advanced tools
Apple Foundation Models adapter for Agentick — on-device inference via macOS 26+
Apple on-device AI for Agentick — inference and embeddings via Foundation Models and NaturalLanguage, running entirely on your machine.
NLContextualEmbeddingDynamicGenerationSchemanpm install @agentick/apple
# or
pnpm add @agentick/apple
The postinstall script compiles the Swift bridge binary. If compilation fails (e.g., on non-macOS or without Xcode), the package still installs but won't be functional until the binary is available.
import { apple } from '@agentick/apple';
import { createApp } from 'agentick';
const Agent = () => (
<>
<System>You are a helpful assistant.</System>
<Timeline />
</>
);
const app = createApp(Agent, { model: apple() });
const session = app.createSession();
const result = await session.send({ messages: [{ role: 'user', content: 'Hello!' }] });
import { appleEmbedding } from "@agentick/apple";
const embedder = appleEmbedding();
// Single text
const { embeddings, dimensions } = await embedder.embed({ input: "Hello world" });
console.log(dimensions); // 512
console.log(embeddings[0].length); // 512
// Batch
const { embeddings } = await embedder.embed({
input: ["machine learning and AI", "deep neural networks", "the cat sat on the mat"],
});
// embeddings → number[3][512]
import { apple } from "@agentick/apple";
import { z } from "zod";
import { zodToJsonSchema } from "zod-to-json-schema";
const recipeSchema = z.object({
title: z.string().describe("Recipe name"),
calories: z.number().int().describe("Total calories"),
ingredients: z.string().describe("Comma-separated ingredients"),
steps: z.string().describe("Newline-separated steps"),
});
const result = await session.send({
messages: [{ role: "user", content: "Create a pasta recipe" }],
responseFormat: {
type: "json_schema",
schema: zodToJsonSchema(recipeSchema),
},
});
const recipe = JSON.parse(result.message.content[0].text);
import { AppleModel } from "@agentick/apple";
const Agent = () => (
<>
<AppleModel />
<System>You are a helpful assistant.</System>
<Timeline />
</>
);
apple(config?)Factory function returning a ModelClass for text generation.
| Option | Type | Default | Description |
|---|---|---|---|
bridgePath | string | auto-detected | Path to Swift bridge binary |
model | string | "apple-foundation-3b" | Model identifier |
Returns a ModelClass usable with createApp, as JSX, or for direct execution.
AppleModelJSX component wrapping apple() for declarative model configuration. Accepts the same props as apple().
appleEmbedding(config?)Factory function returning a callable embedding function.
| Option | Type | Default | Description |
|---|---|---|---|
bridgePath | string | auto-detected | Path to Swift bridge binary |
script | EmbeddingScript | "latin" | Script model to load (see below) |
language | string | — | BCP-47 code (e.g. "en", "fr") for better results |
Returns an AppleEmbeddingFunction:
const embed = appleEmbedding({ script: "latin" });
// Call with a single string or array
const result = await embed("Hello world");
const batch = await embed(["Hello", "World"]);
// Result shape
result.embeddings; // number[][] — one vector per input text
result.dimensions; // number — vector dimensionality (512)
result.model; // "apple-contextual-embedding"
result.script; // "latin"
Each script model covers a group of languages. You pick the script, not individual languages:
| Script | Languages |
|---|---|
"latin" (default) | English, French, German, Spanish, Portuguese, Italian, Dutch, Swedish, Danish, Norwegian, Finnish, Polish, Czech, Hungarian, Romanian, Slovak, Croatian, Indonesian, Turkish, Vietnamese |
"cyrillic" | Russian, Ukrainian, Bulgarian, Kazakh |
"cjk" | Chinese, Japanese, Korean |
"indic" | Hindi, Marathi, Bangla, Urdu, Punjabi, Gujarati, Tamil, Telugu, Kannada, Malayalam |
"thai" | Thai |
"arabic" | Arabic |
The optional language parameter (BCP-47 code like "en", "ja", "ru") refines results when you know the input language.
| Feature | Supported |
|---|---|
| Text generation | Yes |
| Streaming | Yes |
Structured output (json_schema) | Yes |
| On-device embeddings | Yes — 512-dim via NLContextualEmbedding |
| Tool calling | Not yet — see Roadmap |
| Vision/multimodal | No |
| Context window | 4096 tokens |
Uses Apple's DynamicGenerationSchema to enforce constraints at generation time — the model cannot produce invalid output.
Supported types: string, integer, number, boolean, nested objects. Arrays not yet supported in bridge.
Node.js (agentick)
│
├── Text generation ──▶ stdin JSON ──▶ Swift Bridge ──▶ FoundationModels
│ │ │
│ ◀── stdout JSON/NDJSON ──┘
│
└── Embeddings ──▶ stdin JSON ──▶ Swift Bridge ──▶ NLContextualEmbedding
│ │
◀── stdout JSON ────┘
Single Swift binary (apple-fm-bridge) handles both operations, routed by the operation field:
"generate" (default) — text generation via LanguageModelSession"embed" — vector embeddings via NLContextualEmbeddingcd node_modules/@agentick/apple
swiftc -parse-as-library -framework FoundationModels -framework NaturalLanguage -O inference.swift -o bin/apple-fm-bridge
Apple Foundation Models support tool calling via the Tool protocol — the model can autonomously call Swift functions and use results in its response. Our adapter currently doesn't support this because Apple's tool loop runs internally within session.respond().
The path forward is a bidirectional bridge protocol: proxy Tool structs in Swift that write tool_call messages to stdout and read tool_result responses from stdin, letting agentick's tool executors handle execution while Apple's framework manages the model loop.
LanguageModelSession API is text-onlyDynamicGenerationSchema doesn't support dynamic array generationxcode-select --install
The NLContextualEmbedding model assets may need to be downloaded. Ensure Apple Intelligence is enabled and the device has internet access for the initial download.
Apple's on-device models include safety guardrails. Requests for harmful or repetitive content may be rejected — this is expected and cannot be disabled.
MIT
FAQs
Apple Foundation Models adapter for Agentick — on-device inference via macOS 26+
The npm package @agentick/apple receives a total of 126 weekly downloads. As such, @agentick/apple popularity was classified as not popular.
We found that @agentick/apple demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
RubyGems and Bundler 4.0.13 introduced an opt-in cooldown feature that delays newly published gems during dependency resolution.

Security News
pnpm 11.5 now recognizes npm staged publish approvals in release metadata, preventing those releases from being mistaken for lower-trust package publishes.

Security News
Federal audit finds NIST lacked a plan to clear the NVD backlog, wasted funds on duplicate work, and delayed use of CISA data.