Skip to content
Back to skills

Agent Core

ASecurity

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.

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 27, 2026
ai-agentstypescriptgonode

Works with

  • cli

Security analysis

A100/100

Scanned December 2, 2026

npx -y skills add nia-teams/cloud-agent --skill agent-core --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Agent Core?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Agent Core
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nia-teams-agent-core/badge)](https://www.skillsdirectory.com/skills/nia-teams-agent-core)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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`).

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.