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-agentsToolsWebAssembly modulesInterfaces & integrations
Browser clientRouting & middlewareVoiceBrowser toolsMCPEmailObservabilityCLI
Command overviewnewdevrunbuildcompilemigratedeployAPI reference
AgentAgentClientWorkflow classesLocal & cloudMigrationsExamplesCallable methods
Expose a deliberately small typed RPC surface to browser and mobile clients.
Use @callable for external clients
Decorate methods that a browser should call through agent.stub. Arguments and return values must be serializable. Plain public methods remain available to internal Durable Object RPC without becoming browser-callable.
import { Agent, callable } from "ayjnt";
export default class ReviewAgent extends Agent {
@callable({ description: "Submit a document for review." })
async submit(documentId: string): Promise<{ accepted: true }> {
await this.queue("review", { documentId });
return { accepted: true };
}
// Internal RPC only: no decorator.
async review(payload: { documentId: string }) {
// ...
}
}Streaming and failures
Use @callable({ streaming: true }) with StreamingResponse for incremental results. Throwing rejects the client call; prefer stable, structured error shapes for failures a UI is expected to handle.
Callable RPC travels over the Agent WebSocket protocol. Agent-to-agent calls use Durable Object RPC instead, which is more direct and does not require the decorator.