npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@robota-sdk/agent-core

v3.0.0-beta.73

Published

Complete AI agent implementation with unified core and tools functionality - conversation management, plugin system, and advanced agent features

Readme

Agent Core

The foundation layer of the Robota SDK. Provides the Robota agent class, abstract base classes for providers/tools/plugins, the permission system, hook system, event services, and error hierarchy.

Installation

npm install @robota-sdk/agent-core

Quick Start

import { Robota } from '@robota-sdk/agent-core';
import { AnthropicProvider } from '@robota-sdk/agent-provider/anthropic';

const provider = new AnthropicProvider({ apiKey: process.env.ANTHROPIC_API_KEY });

const agent = new Robota({
  name: 'MyAgent',
  aiProviders: [provider],
  defaultModel: {
    provider: 'anthropic',
    model: 'claude-sonnet-4-6',
    systemMessage: 'You are a helpful assistant.',
  },
});

const response = await agent.run('Hello, world!');
console.log(response);

Key Features

  • Robota class: AI agent with conversation history, tool execution, and plugin support
  • ConversationStore: Append-only conversation history with streaming buffer (beginAssistant/appendStreaming/commitAssistant)
  • IBaseMessage: Every message has a unique id (UUID) and state ('complete' | 'interrupted')
  • Multi-provider: Register multiple providers, switch dynamically with setModel()
  • Provider capabilities: Provider-neutral capability reports distinguish local tools from provider-native hosted web search/fetch
  • AbstractAIProvider.streamWithAbort(): Standard streaming wrapper for all providers — handles AbortSignal, returns partial content on abort
  • Permission system: Deterministic 3-step policy evaluation (evaluatePermission)
  • Hook system: Shell command-based lifecycle hooks (runHooks)
  • Plugin system: AbstractPlugin base class with lifecycle hooks (beforeRun, afterRun, onError, etc.)
  • Event services: Unified event emission with owner path tracking
  • Error hierarchy: Typed errors extending RobotaError (ProviderError, RateLimitError, etc.)
  • Model definitions: Central CLAUDE_MODELS registry with context windows, output limits, and human-readable names
  • callProviderWithCache: Accepts Partial<IChatOptions> overrides for per-call configuration
  • AbortSignal propagation: Signal flows through the entire execution chain (Session -> Robota -> Provider)
  • Execution boundary events: Robota.run() can emit provider/tool provenance events through onExecutionEvent
  • Type safety: Strict TypeScript, zero any in production code

Robota API

const agent = new Robota(config);

// Send a message (executes tool calls automatically)
const response = await agent.run('Hello');

// Conversation history
const history = agent.getHistory(); // TUniversalMessage[]
agent.clearHistory();

// Switch provider/model mid-conversation
agent.setModel({ provider: 'openai', model: 'gpt-4o' });

Execution Boundary Events

run() accepts onExecutionEvent in run options. The execution loop emits provider-neutral events that higher layers can persist as append-only session provenance:

  • provider_request
  • provider_native_raw_payload
  • provider_stream_raw_delta
  • provider_response_raw
  • provider_response_normalized
  • assistant_message_committed
  • tool_batch_started
  • tool_execution_request
  • tool_execution_result
  • tool_message_committed
  • history_mutation

Provider-specific SDK payload capture remains provider-owned. Providers may call IChatOptions.onProviderNativeRawPayload with exact SDK request, response, or stream event objects; Robota forwards those callbacks as provider-neutral provider_native_raw_payload execution events without importing concrete provider SDK types. provider_response_raw.responseKind remains provider-normalized-message, which keeps common replay validation provider-neutral.

IAgentConfig

| Field | Type | Description | | ---------------------------- | -------------------------- | ------------------------------ | | name | string | Agent name | | aiProviders | IAIProvider[] | One or more provider instances | | defaultModel.provider | string | Provider name | | defaultModel.model | string | Model identifier | | defaultModel.systemMessage | string? | System prompt | | tools | IToolWithEventService[]? | Tools the agent can call | | plugins | IPluginContract[]? | Plugins for lifecycle hooks |

Architecture

agent-core (this package — zero workspace dependencies)
  ↑
agent-sessions    ← Session lifecycle
agent-tools       ← Tool implementations
agent-providers   ← AI provider implementations
agent-plugins     ← Plugin implementations (8 extracted packages)
  ↑
agent-sdk         ← Assembly layer
  ↑
agent-cli         ← Terminal UI

Public API Surface

| Category | Exports | | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Core | Robota, ConversationStore, AbstractAgent, AbstractAIProvider (+ streamWithAbort), AbstractPlugin, AbstractTool, AbstractExecutor, LocalExecutor, getProviderCapabilities, assertProviderNativeWebToolsAvailable | | Permissions | evaluatePermission, MODE_POLICY, TRUST_TO_MODE, UNKNOWN_TOOL_FALLBACK, TPermissionMode, TTrustLevel, TPermissionDecision, TToolArgs, IPermissionLists, TKnownToolName | | Hooks | runHooks, CommandExecutor, HttpExecutor, IHookTypeExecutor, THookEvent, THooksConfig, IHookGroup, IHookDefinition, IHookInput, IHookResult | | Events | EventEmitterPlugin, IEventService, IOwnerPathSegment | | Models | CLAUDE_MODELS, DEFAULT_CONTEXT_WINDOW, DEFAULT_MAX_OUTPUT, getModelContextWindow(), getModelMaxOutput(), getModelName(), formatTokenCount(), IModelDefinition | | Context | estimateContextTokensFromMessages(), estimateSerializedContextTokens(), readTokenUsageFromMessage(), IContextTokenEstimate, IMessageTokenUsage, IContextWindowState, IContextTokenUsage | | Types | TUniversalMessage, IBaseMessage (id, state), TMessageState, IAgentConfig, IAIProvider, IProviderCapabilities, IProviderNativeWebToolRequest, IToolSchema, TTextDeltaCallback | | Errors | RobotaError, ProviderError, RateLimitError, AuthenticationError, ToolExecutionError, etc. | | Managers | AgentFactory, AgentTemplates, ConversationHistory, EventHistoryModule |

What Moved Out in v3

| What | Moved to | | --------------------------------------------- | ---------------------------- | | FunctionTool, ToolRegistry, OpenAPITool | @robota-sdk/agent-tools | | MCPTool, RelayMcpTool | @robota-sdk/agent-tool-mcp | | 8 plugins (logging, usage, performance, etc.) | @robota-sdk/agent-plugin-* |

License

MIT