Skip to Content
Naylence Docs are in active development. Share feedback in Discord.
Getting startedTypeScript

Getting started with Naylence for TypeScript

This quickstart mirrors the examples/simple/hello.ts sample in the Naylence TypeScript examples repo  and shows the minimum to spin up a fabric, serve an agent, and send it a message.

This single-process example runs agent and client in the same process. It’s meant to teach the core Agent SDK concepts without any distributed wiring (no sentinel, no fabric admission URLs, no Docker networking). It starts a local fabric, serves an agent, obtains a typed proxy, makes a call, and prints results.

Prerequisites

  • Node.js 18+
  • npm (or pnpm) and a terminal

1) Install the SDK dependencies

npm init -y npm install @naylence/agent-sdk tsx

2) Create hello.ts

import { withFabric } from "@naylence/runtime"; import { BaseAgent } from "@naylence/agent-sdk"; class HelloAgent extends BaseAgent { async onMessage(message: string) { console.log(`Agent received message: ${message}`); } } async function main(): Promise<void> { await withFabric(async (fabric) => { const agentAddress = await fabric.serve(new HelloAgent()); fabric.sendMessage(agentAddress, "Hello, World"); }); } void main().catch((error) => { console.error("hello example failed", error); });

3) Run it

npx tsx hello.ts

Expected output:

Agent received message: Hello, World

Next steps

Last updated on