Build agents with @nia-teams/agent-core: AgentRuntime runs one turn in one process; AgentHost deploys it across replicas — one replica per session, stream resume after disconnect, takeover after crash. Use when code imports @nia-teams/agent-core or an agent must run as a horizontally scaled service.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Agent Core?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nia-teams-agent-core)
---
name: agent-core
description: Build agents with @nia-teams/agent-core: AgentRuntime runs one turn in one process; AgentHost deploys it across replicas — one replica per session, stream resume after disconnect, takeover after crash. Use when code imports @nia-teams/agent-core or an agent must run as a horizontally scaled service.
---
`AgentRuntime` (`@nia-teams/agent-core`) runs one turn in one process over `ConversationStore` (`InMemoryConversationStore` for local state).
`AgentHost` (`@nia-teams/agent-core/host`) coordinates multi-replica deployment: it keeps each session on one replica, lets clients reconnect via snapshot + live events, and lets another replica take over after a crash.
For a local turn, construct `AgentRuntime` with `InMemoryConversationStore` and call `run({ client, systemPrompt, tools, onEvent })`. Narrow events by `event.type`; emit custom tool events with `ctx.onEvent({ type: 'custom', name, data })`.
For multi-replica deployment, import `createAgentHost` from `@nia-teams/agent-core/host` and pass shared MongoDB/Redis adapters (`@nia-teams/agent-core/docstore-mongo`, `@nia-teams/agent-core/pubsub-redis`); `createMemoryDocStore` and `createMemoryPubSub` work only within a single process.
Call `host.start()`, `host.injectMessage` (creates the session if absent), `host.openSnapshotStream(res, { sessionId, format: 'sse' })`, and `host.stop()` on shutdown.
HTTP authentication, session authorization, and rate limiting belong in the application server.
For native tool media, configure `mediaStore` and `mediaInput` on `AgentRuntime` or on the `AgentConfig` resolved for built-in `AgentHost` turns. `ctx.storeMedia` returns a `MediaRef` or throws; uncaught errors become tool results with `isError: true`. Return the references in `ToolExecutionResult.media`; the runtime resolves them per request with a fixed 20 MiB raw-byte budget for base64 media. `MediaStore.put` receives `sessionId` directly. Base64-backed stores encode once on `put`; `getBase64` reads the stored string without a `data:` prefix. Call `mediaStore.delete(sessionId)` to remove a retired session’s media. `InMemoryMediaStore` is for process-local use.
Exact signatures: `node_modules/@nia-teams/agent-core/dist/**/*.d.ts`. Reference manual & TypeScript examples: `node_modules/@nia-teams/agent-core/README.md` (run `.ts` snippets with `npx tsx`).