Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

@a2ui/agent

Latest version: v0.2.0

Overview

Last scanned
23 Nov 2026
Published
23 Nov 2026
npm package Publisher: a2ui-team, ava-cassiopeia, jsimionato
18,327 Stars
1,475 Forks
5 Versions
18.4K Downloads
TypeScript Repo language

Scan summary

@a2ui/agent was last scanned on 23 Nov 2026 at version 0.2.0. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 5 versions; the latest was published on 23 Nov 2026.
  • Findings: No rules fired in version 0.2.0.
  • Downloads: 18,421 downloads.

Versions

5 versions published
Versions and the rules that fired in each
VersionPublishedStatus
0.2.0 LATEST 23 Nov 2026 No rules fired
0.1.0 2 Nov 2026 No rules fired
0.0.2 24 Oct 2026 No rules fired
0.0.1 19 Oct 2026 Not shown
0.0.0-stage 19 Oct 2026 Not shown

No rules fired in 0.2.0

Findings

Findings for v0.2.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 0.2.0; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

@a2ui/agent

A2UI Agent SDK for TypeScript and Node.js.

This package targets A2UI protocol v0.9 and v1.0, and supports the Direct JSON and Express inference formats.

Getting started

Load your catalogs once at startup and create an A2uiGenerator. On each turn, create a request processor for the client's capabilities, include its promptSnippet in your system prompt, and pass the model's response to parseResponse:

import {A2uiGenerator, CatalogConfig, readRendererCapabilities} from '@a2ui/agent';

// 1. Load catalogs and build the generator once at startup.
const componentCatalog = CatalogConfig.fromPath('path/to/catalog.json');
const generator = new A2uiGenerator([componentCatalog]);

// 2. Per request, extract client capabilities from transport metadata.
const capabilities = readRendererCapabilities(requestMetadata);
if (!capabilities) {
  // Client did not request A2UI on this turn; reply with plain text.
  return;
}
const processor = generator.createProcessor(capabilities);

// 3. Append processor.promptSnippet to your LLM system prompt, then parse the reply.
const systemPrompt = `You are a helpful assistant.\n\n${processor.promptSnippet}`;
const llmResponse = await callYourModel(systemPrompt, userMessage);

for (const part of processor.parseResponse(llmResponse)) {
  if (part.type === 'text') {
    console.log('Text:', part.text);
  } else {
    // Validated AgentToRendererMessage[] ready to send to the renderer
    console.log('A2UI messages:', part.a2ui);
  }
}

parseResponse throws an A2uiError when a block cannot be read or a renderer would reject a message. The error's partialResults holds the parts before the failing block, or only the text when the tree check across every block fails. None of them is applied to the state.

Chat and canvas

Every response is checked against a RendererState, the agent's record of the surfaces one renderer holds. How long the state lives decides what a response may refer to:

  1. In a chat, each turn shows new UI. Pass no state, and each call checks the response against a new, empty one, so an update to a surface the response did not create is rejected.
  2. In a canvas, turns update the surfaces earlier turns created. Create one state per conversation and pass it on every turn, or bind it to the processor:
const state = processor.createState();
processor.parseResponse(firstReply, {state});
// A later turn may refer to the components the first turn sent.
processor.parseResponse(secondReply, {state});

// Or bind the state, so that calls use it by default:
const canvas = generator.createProcessor(capabilities, undefined, {state});
canvas.parseResponse(thirdReply);

A response parsed whole is applied to the state all or nothing. To check one payload with no record of earlier ones, such as the argument of a tool call, use validatePayload(catalogs, messages).

Streaming

Both Express and Direct JSON responses can be read as they arrive. openStream returns a ResponseStream for one response: pass each chunk to feed and call close after the last one. Each message the stream emits has been checked and applied to the state, so a canvas state matches what the client received even when a response fails part way.

const stream = processor.openStream({state});
for await (const chunk of modelStream) {
  for (const part of stream.feed(chunk)) send(part);
}
for (const part of stream.close()) send(part);

close emits text that was held back because it could have started a tag, throws a ParseError if a block is still open, and checks the tree of a response read with wrapped: false. A stream that throws has ended. The error's partialResults holds the parts the chunk made ready before the failure, which have been applied to the state, so send them too.

By default the first rejected block ends the stream. To show the rest of the response, open the stream with afterRejectedBlock: 'continue'. feed and close then return an ErrorPart in place of a rejected block and go on with the text and blocks after it. The messages the block emitted before it was rejected stay in the state.

const stream = processor.openStream({afterRejectedBlock: 'continue'});
for (const part of stream.feed(chunk)) {
  if (part.type === 'error') showError(part.error);
  else send(part);
}

stream.isInBlock tells whether the response read so far ends inside a block. A client that joins the chunks of a paused and resumed response reads it before adding a space between them, since a space inside a block could break it.

In wrapped: true mode, openStream strips Markdown code fences and inline backticks placed either inside or immediately outside <a2ui> and </a2ui> tags, checks surface topology as each <a2ui> block closes (unlike parseResponse, which checks topology across all blocks at the end of the response), and requires the opening <a2ui> tag rather than recovering a block whose opening tag was omitted.

An app that is both agent and renderer

An app that calls the model and renders its answer itself, such as a chat in the browser, checks and renders each message once by giving the stream a state on the processor it renders from:

import {MessageProcessor} from '@a2ui/web_core';

const renderer = new MessageProcessor([catalog], undefined, {
  outboundListener: message => {
    if (!('error' in message)) sendToAgent(message);
  },
  unifiedOutbound: true,
});
const stream = processor.openStream({state: RendererState.of(renderer)});
stream.feed(chunk); // the surfaces show up in renderer.model

StreamedAnswer does this for one answer and keeps its parts in the order the model wrote them: its text, a part for each surface it creates, and an ErrorPart where it rejected a block, followed by the text and surfaces after it.

const answer = new StreamedAnswer(processor, {
  renderer: new MessageProcessor([catalog], undefined, {
    outboundListener: message => {
      if (!('error' in message)) sendToAgent(message);
    },
    unifiedOutbound: true,
  }),
});
answer.feed(chunk);
answer.close();
answer.parts; // text, surfaces and errors, in order

Loading catalogs

The SDK bundles no catalogs. Load catalog JSON documents with CatalogConfig.fromPath or FileSystemCatalogProvider, or pass an existing object to InMemoryCatalogProvider.

The emitted protocol version is taken from the catalog. Because the v0.9 basic catalog JSON document omits both protocolVersion and catalogId, pass them explicitly when loading it:

const v09Catalog = CatalogConfig.fromPath(
  'catalogs/basic/v0_9/catalog.json',
  [],
  'v0.9',
  'https://a2ui.org/specification/v0_9/catalogs/basic/catalog.json',
);

Agent functions

From v1.0, a catalog can declare functions that run on the agent: a renderer that doesn't implement a function sends callAgentFunction and waits for the agent's agentFunctionResponse. Add agent functions to your copy of a catalog with copyWith. AgentFunction.fromApi binds a handler to a function the catalog already declares, and new AgentFunction(...) adds a new one, with its arguments as a Zod schema (which types the handler) or a JSON Schema object. A v1.0 catalog checks that the parameter names are UAX #31 identifiers when it gets the function. A handler takes (args) or (args, context), where context has the catalog, surface and call IDs. withHandler returns a copy bound to another handler, such as a test double.

import {AgentFunction} from '@a2ui/agent';
import {z} from 'zod';

const catalog = loaded.copyWith({
  agentFunctions: [
    AgentFunction.fromApi<{id: string}>(loaded.functions.get('lookupAccount')!, args =>
      findAccount(args.id),
    ),
    new AgentFunction({
      name: 'fetchFxRate',
      returnType: 'number',
      schema: z.object({base: z.string()}),
      // `base` is a string, and the handler must return a number.
      handler: async ({base}) => fetchRate(base),
    }),
  ],
});

RendererToAgentMessageProcessor takes each message the renderer sends and returns whether it handled it and the messages to send back. It answers callAgentFunction itself, and passes action, error and rendererFunctionResponse messages to their callback, after checking them against the v1.0 schema. A message whose callback isn't set, or whose callback returns false to decline it, comes back with handled: false, so the app can pass it on to the model.

const messages = new RendererToAgentMessageProcessor({
  catalogs: [catalog],
  agentFunctionTimeoutMs: 10_000,
  onError: message => log.warn(message.error),
  // Handle the button that saves locally; let the model answer the others.
  onAction: message => (message.action.name === 'save' ? save(message) : false),
});

for (const fromRenderer of request.messages) {
  const {handled, replies} = await messages.processMessage(fromRenderer);
  for (const reply of replies) send(reply);
  if (!handled) runModelTurn(fromRenderer);
}

The processor handles one message per call, so the app decides whether to process a request's messages one after another or concurrently, and what to do when one of them fails. A message whose version isn't '1.0' is an A2uiValidationError. The processor keeps no state between messages, so build one per agent, or one per request from the catalogs the request uses. Two catalogs with the same id are an A2uiCatalogError.

Calling renderer functions

An agent calls a function the renderer implements with callRendererFunction. RendererFunctionCalls builds the message and gives a promise of the result, which resolve settles when the rendererFunctionResponse arrives. Pass resolve to the processor as onRendererFunctionResponse. It returns false for a response to a call it isn't waiting for, such as one the model wrote, so the processor leaves that response unhandled for the model:

const calls = new RendererFunctionCalls({defaultTimeoutMs: 10_000});
const messages = new RendererToAgentMessageProcessor({
  catalogs: [catalog],
  onRendererFunctionResponse: calls.resolve,
});

const [message, locale] = calls.call<string>({catalogId: catalog.id, name: 'getLocale'});
send(message);
console.log(await locale); // once the renderer's response has gone through messages.processMessage

Pass the catalogs the renderer was sent as catalogs, and call checks each call against them before anything is sent: a catalog the catalogs don't have, or a function that isn't one of its rendererFunctions (an agent function runs on the agent, not the renderer), is an A2uiRpcError with UNKNOWN_FUNCTION, and a function the agent may not call (its allowedCallers is rendererOnly or omitted, or it requires user activation, which a call from the agent can't give) is one with INVALID_FUNCTION_CALL. The arguments aren't checked against the function's schema.

const calls = new RendererFunctionCalls({catalogs: [catalog]});

Each instance keeps its pending calls in memory, so a response must reach the same instance that made the call, over a connection that stays open such as a WebSocket. A call fails with TIMEOUT when no response arrives in time: after defaultTimeoutMs (30 seconds unless set), or the call's own timeoutMs, a finite number greater than 0. With defaultTimeoutMs: null, calls without their own timeoutMs never time out.

call throws before anything is sent or becomes pending when the call can't be made: a RangeError for a bad timeoutMs, and otherwise an A2uiRpcError with INVALID_FUNCTION_CALL (or DISPOSED, DUPLICATE, TOO_MANY_PENDING). The name must be a UAX #31 identifier that doesn't start with @, and args a plain object whose keys are UAX #31 identifiers and whose values are JSON values (no NaN, Infinity, undefined, functions or class instances). Nested @call and @path objects are sent as they are, for the renderer to check. The arguments are checked before the catalogs.

A call fails with CANCELLED when it is cancelled or the instance disposed, and with the renderer's error code when the renderer reports one.

Development

yarn workspace @a2ui/agent test
yarn workspace @a2ui/agent lint
yarn workspace @a2ui/agent format

The timing suites of the conformance tests, conformance/agent/direct_json/scaling.yaml and conformance/agent/express/scaling.yaml, check that parsing and streaming a response take time in proportion to its size. Times depend on the machine, so test leaves them out. Run them on their own:

yarn workspace @a2ui/agent test:timing

Architecture, design decisions, and parser regeneration instructions live in the codebase blueprint.

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • npm @a2ui/agent

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Microsoft's Official agent framework Hijacked
AI & VibeSec

BREAKING: Hijacked Releases of Microsoft’s Official agent-framework Steals Azure and CI Credentials

CVE

Java4Shell (CVE-2026-114938): Easy to Crash, Hard to Exploit — Less Than 0.12% of JVMs Estimated at Risk of RCE

Copy of Template Design OX Blog (1)
Research

Thousands Of GitHub Accounts Hijacked With wfx-loot CI Secret Stealing Malware Via GitHub Actions & npm

Frame 2085668439 (1)
Group 1261154229