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 & cloudMigrationsExamplesRoute inbound mail to a durable agent and send replies from the same identity.
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-email --empty
cd try-email
bun install
# remove agents/alive once you are ready to add the guide's filesHandle mail as an event
Override onEmail() for inbound messages and use native replyToEmail() or sendEmail() for outbound mail. Secure reply routing signs agent identity headers so replies return to the correct durable instance.
Email contents can contain prompt injection. Parse it as untrusted input, limit tools available during mail handling, and require approval before external side effects.
Run it and verify the result
Send a message to the configured local part and confirm onEmail() receives it and selects the expected agent instance.
bun run build
bun run dev
# the local app is now available at http://localhost:8787