
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
@agentuity/runtime
Advanced tools
Server runtime for building Agentuity applications with Bun and Hono.
bun add @agentuity/runtime
@agentuity/runtime provides the server-side runtime for Agentuity applications. Built on Hono and optimized for Bun, it enables you to create type-safe agents with automatic routing, validation, and observability.
import { createApp } from '@agentuity/runtime';
const { server, logger } = await createApp();
logger.info('Server running on %s', server.url);
import { createAgent } from '@agentuity/runtime';
import { s } from '@agentuity/schema';
const agent = createAgent('greeting', {
description: 'A simple greeting agent',
schema: {
input: s.object({
message: s.string(),
}),
output: s.object({
response: s.string(),
}),
},
handler: async (ctx, input) => {
ctx.logger.info('Processing message:', input.message);
return { response: `You said: ${input.message}` };
},
});
export default agent;
import { createRouter } from '@agentuity/runtime';
import greetingAgent from './agent/greeting';
const router = createRouter();
router.get('/hello', (c) => {
return c.json({ message: 'Hello, world!' });
});
// Route with agent validation
router.post('/greeting', greetingAgent.validator(), async (c) => {
const data = c.req.valid('json'); // Fully typed from agent schema!
const result = await greetingAgent.run(data);
return c.json(result);
});
export default router;
router.stream('/events', async (c) => {
return new ReadableStream({
start(controller) {
controller.enqueue('Event 1\n');
controller.enqueue('Event 2\n');
controller.close();
},
});
});
router.websocket('/chat', (c) => (ws) => {
ws.onOpen(() => {
console.log('Client connected');
});
ws.onMessage((event) => {
const data = JSON.parse(event.data);
ws.send(JSON.stringify({ echo: data }));
});
ws.onClose(() => {
console.log('Client disconnected');
});
});
router.sse('/updates', (c) => async (stream) => {
for (let i = 0; i < 10; i++) {
await stream.writeSSE({
data: JSON.stringify({ count: i }),
event: 'update',
});
await stream.sleep(1000);
}
});
Creates a new Agentuity application instance.
Returns:
router - Hono application instanceserver - Server instance with listen() methodlogger - Structured loggerCreates a type-safe agent with input/output validation.
Config:
schema.input? - Schema for input validation (Zod, Valibot, etc.)schema.output? - Schema for output validationhandler - Agent handler function (ctx, input) => outputCreates a new router for defining custom API routes.
Methods:
get/post/put/delete/patch - HTTP method handlersstream(path, handler) - Streaming response handlerwebsocket(path, handler) - WebSocket handlersse(path, handler) - Server-Sent Events handlerContext object available in agent handlers:
interface AgentContext {
logger: Logger; // Structured logger
tracer: Tracer; // OpenTelemetry tracer
sessionId: string; // Unique session ID
kv: KeyValueStorage; // Key-value storage
stream: StreamStorage; // Stream storage
vector: VectorStorage; // Vector storage
state: Map<string, unknown>; // Request-scoped state
thread: Thread; // Thread information
session: Session; // Session information
config: TConfig; // Agent-specific config from setup
app: TAppState; // Application state from createApp
waitUntil: (promise) => void; // Defer cleanup tasks
}
Agentuity provides built-in storage abstractions:
Access these via the agent context:
const agent = createAgent('storage-example', {
schema: {
output: s.object({ value: s.string().optional() }),
},
handler: async (ctx, input) => {
await ctx.kv.set('key', 'value');
const value = await ctx.kv.get('key');
return { value };
},
});
Built-in OpenTelemetry support for logging, tracing, and metrics:
const agent = createAgent('observability-example', {
schema: {
output: s.object({ success: s.boolean() }),
},
handler: async (ctx, input) => {
ctx.logger.info('Processing request');
const span = ctx.tracer.startSpan('custom-operation');
// ... do work ...
span.end();
return { success: true };
},
});
Fully typed with TypeScript. Input and output types are automatically inferred from your schemas.
Apache 2.0
FAQs
Unknown package
The npm package @agentuity/runtime receives a total of 1,905 weekly downloads. As such, @agentuity/runtime popularity was classified as popular.
We found that @agentuity/runtime demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.