Documentation menu
Start here
IntroductionGetting startedWrite an agentProject anatomyUnderstand Ayjnt
Harness engineeringTwo runtimesHuman interfacesHow agents workHost bridgeAgent capabilities
Callable methodsState & SQLiteSessions & memorySchedulingWorkflowsDurable executionInter-agent RPCSub-agentsToolsInterfaces & integrations
Browser clientRouting & middlewareVoiceBrowser toolsMCPEmailObservabilityCLI
Command overviewnewdevrunbuildcompilemigratedeployAPI reference
AgentAgentClientWorkflow classesLocal & cloudMigrationsExamplesInter-agent communication
Call a separately bound agent by durable name with typed RPC.
Start from a fresh project
This guide is self-contained. Create an empty Ayjnt project, then replace the starter agent with the files shown below. Run commands from the new project directory unless a step says otherwise.
bunx ayjnt new try-inter-agent --empty
cd try-inter-agent
bun install
# remove agents/alive once you are ready to add the guide's filesUse this.agent inside Ayjnt Agent
The protected this.agent() helper is Ayjnt’s typed wrapper around Cloudflare getAgentByName(). The target has its own top-level Durable Object namespace and storage.
import { Agent } from "ayjnt";
import InventoryAgent from "../inventory/agent";
export default class OrdersAgent extends Agent {
async reserve(sku: string, quantity: number) {
const inventory = await this.agent(InventoryAgent, "primary");
return inventory.reserve(sku, quantity);
}
}Outside an Agent
Import getAgent<T>() from ayjnt when calling from a Worker handler or other framework code. Browser code should use callable methods instead of a Durable Object binding.
Internal agent RPC does not need @callable(). Public methods are callable through the typed Durable Object stub.
Run it and verify the result
Call the order agent once. Autocomplete should expose the inventory agent’s public methods, and both agent instances should preserve independent state.
bun run build
bun run dev
# the local app is now available at http://localhost:8787