
Security News
GPT-6 Astra Attempts Supply Chain Attacks Against Open Source Maintainers in Testing
GPT-6 Astra hits 100% on ExploitBench and finds zero-days autonomously, while independent tests reveal scope violations and monitoring gaps.
@agentskit/core
Advanced tools
Portable AgentsKit runtime for chat orchestration, tools, memory, and retrieval.
Profile: major-package
The zero-dependency foundation that every AgentsKit package builds on — under the 10 KB gzip budget, edge-ready, works everywhere JavaScript runs.
Tags: ai · agents · llm · agentskit · typescript · orchestration · streaming · chat
packages/core/.@agentskit/core is the contract layer: the tiny, stable foundation that makes adapters, tools, skills, memory, retrievers, and runtimes interchangeable.
Docs: package guide · agent handoff
Adapter, Tool, Skill, Memory, Retriever, Runtime) make every package interchangeablecreateChatController handles streaming, abort, and message history so you never implement that loop yourselfnpm install @agentskit/core
import { createChatController, createInMemoryMemory } from '@agentskit/core'
import { anthropic } from '@agentskit/adapters'
const controller = createChatController({
adapter: anthropic({ apiKey: process.env.ANTHROPIC_API_KEY, model: 'claude-sonnet-4-6' }),
memory: createInMemoryMemory(),
})
await controller.send('Hello!')
console.log(controller.getState().messages)
createChatController — streaming-capable chat state machine with abort support; memory is saved after successful turns, never after failed or aborted turns. Background memory and skill activation failures are surfaced through onError.createInMemoryMemory — zero-config in-process memory for prototypingcreateLocalStorageMemory — browser/demo persistence; malformed stored data raises MemoryError instead of silently becoming an empty historycreateStaticRetriever — deterministic token-overlap retrieval for demos and fallbacks; use @agentskit/rag for semantic production retrievalparseToolArgs — typed JSON argument parsing for adapters that need fail-closed validation; safeParseArgs remains the compatibility helperToolDefinition, SkillDefinition, AgentEvent, Adapter, ChatMemory, Retriever, ChatControllerAgentEvent streams — observability hooks attach hereAgentEvent.correlation is an optional, provider-neutral identity envelope: operationId is stable across boundaries while runId, sessionId, turnId, actionId, and traceId retain local meaninganyAgentsKit ships a didactic error system inspired by the Rust compiler. Every error includes a code, a hint for the fix, and a docsUrl — no more vague "Something went wrong" messages.
import {
AgentsKitError,
AdapterError,
ToolError,
MemoryError,
ConfigError,
ErrorCodes,
} from '@agentskit/core'
try {
await runtime.run(task)
} catch (err) {
if (err instanceof ToolError) {
// err.code → 'AK_TOOL_EXEC_FAILED'
// err.hint → actionable suggestion
// err.docsUrl → https://www.agentskit.io/docs/agents/tools
console.error(err.toString())
// error[AK_TOOL_EXEC_FAILED]: ...
// --> Hint: ...
// --> Docs: https://www.agentskit.io/docs/agents/tools
}
}
Available error codes (via ErrorCodes):
| Code | Thrown by |
|---|---|
AK_ADAPTER_MISSING | adapter not provided to the controller |
AK_ADAPTER_STREAM_FAILED | streaming call to the provider fails |
AK_TOOL_NOT_FOUND | requested tool name is not registered |
AK_TOOL_EXEC_FAILED | execute() throws |
AK_TOOL_PEER_MISSING | optional tool peer dependency is not installed |
AK_TOOL_INVALID_INPUT | tool arguments or proposal are invalid |
AK_TOOL_QUOTA_EXCEEDED | tool execution exceeds its configured quota |
AK_TOOL_FORBIDDEN | tool execution is denied by policy |
AK_MEMORY_LOAD_FAILED | memory.load() fails |
AK_MEMORY_SAVE_FAILED | memory.save() fails |
AK_MEMORY_CLEAR_FAILED | memory.clear() fails |
AK_MEMORY_DESERIALIZE_FAILED | persisted state is corrupt |
AK_MEMORY_PEER_MISSING | optional memory backend is not installed |
AK_MEMORY_REMOTE_HTTP | remote memory request fails |
AK_CONFIG_INVALID | required config is missing or wrong type |
AK_RUNTIME_INVALID_INPUT | runtime input is invalid |
AK_RUNTIME_STEP_FAILED | a runtime step fails |
AK_RUNTIME_DELEGATE_FAILED | delegated agent execution fails |
AK_SANDBOX_DENIED | sandbox policy denies execution |
AK_SANDBOX_INVALID_TOOL | tool is not valid for the sandbox |
AK_SANDBOX_PEER_MISSING | optional sandbox backend is not installed |
AK_SANDBOX_BACKEND_FAILED | sandbox backend fails |
AK_SKILL_INVALID | skill definition is invalid |
AK_SKILL_DUPLICATE | skill identity is duplicated |
defineTooldefineTool infers the TypeScript type of execute's args parameter from the JSON Schema — no manual casting.
import { defineTool } from '@agentskit/core'
const greet = defineTool({
name: 'greet',
schema: {
type: 'object',
properties: { name: { type: 'string' } },
required: ['name'],
} as const, // as const is required for inference
execute(args) {
// args.name → string (inferred, not cast)
return `Hello, ${args.name}!`
},
})
Use InferSchemaType<typeof schema> to reference the inferred type elsewhere in your codebase.
| Subpath | Purpose |
|---|---|
@agentskit/core/agent-schema | Declarative YAML/JSON agent definitions + validator |
@agentskit/core/prompt-experiments | A/B prompts with PostHog / GrowthBook / custom flag providers |
@agentskit/core/auto-summarize | ChatMemory wrapper that folds old turns into a summary |
@agentskit/core/hitl | Approval gates + ApprovalStore |
@agentskit/core/security | PII redactor + injection detector + rate limiter |
@agentskit/core/fuzzy-match | Deterministic Jaro-Winkler matching for KYC, sanctions, deduplication, and entity resolution |
@agentskit/core/finding | Canonical Finding / Severity shape for review and compliance results |
@agentskit/core/compose-tool | Chain N tools into one macro tool |
@agentskit/core/self-debug | Retry failing tools with LLM-corrected arguments |
@agentskit/core/generative-ui | Typed UI element tree + code / markdown / html / chart artifacts |
@agentskit/core/a2a | Agent-to-Agent protocol spec (JSON-RPC over any transport) |
@agentskit/core/manifest | Skill + tool manifest format (MCP-compatible) |
@agentskit/core/eval-format | Portable eval dataset + run-result JSON |
@agentskit/core/memory-validation | Bounded validation for untrusted serialized memory records |
@agentskit/core/tool-proposal | Public helper for routing a validated proposal through controller authorization |
See the core guide for agents for the full contract.
| Package | Role |
|---|---|
| @agentskit/adapters | LLM chat + embedding providers, router, ensemble, fallback |
| @agentskit/runtime | createRuntime, speculate, topologies, durable execution, background agents |
| @agentskit/react | useChat, headless chat components |
| @agentskit/vue · svelte · solid · react-native · angular | Same ChatReturn contract, one package per framework |
| @agentskit/tools | Built-in tools, 20+ integrations, MCP bridge |
| @agentskit/memory | Chat + vector + hierarchical + encrypted + graph stores |
| @agentskit/rag | Plug-and-play RAG + reranker + loaders |
| @agentskit/skills | Ready-made personas + marketplace |
| @agentskit/observability | Traces, audit log, cost guard, devtools |
| @agentskit/sandbox | Secure code execution + mandatory sandbox policy |
| @agentskit/eval | Eval suites, deterministic replay, snapshots, CI reporter |
| @agentskit/cli | agentskit init / chat / run / ai / dev / doctor |
MIT — see LICENSE.
@agentskit/coreSee CONTRIBUTING.md and the monorepo LICENSE.
FAQs
Portable AgentsKit runtime for chat orchestration, tools, memory, and retrieval.
The npm package @agentskit/core receives a total of 52,552 weekly downloads. As such, @agentskit/core popularity was classified as popular.
We found that @agentskit/core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Security News
GPT-6 Astra hits 100% on ExploitBench and finds zero-days autonomously, while independent tests reveal scope violations and monitoring gaps.

Product
Socket can now send alerts and supply chain attack notifications to Microsoft Teams, with filters that route the right updates to each channel.

Security News
pnpm 12 rewrites the package manager in Rust, cutting install times by up to 90% while preserving pnpm 11 workflows and lockfiles.