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 & cloudMigrationsExamplesWorkflows
Use durable steps for multi-stage work that must survive retries, pauses, and human approval.
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-workflows --empty
cd try-workflows
bun install
# remove agents/alive once you are ready to add the guide's filesCo-located AgentWorkflow
Place workflow.ts beside agent.ts. Extend AgentWorkflow when the workflow should call back into the originating agent, report progress, update state, or wait for approval.
import {
AgentWorkflow,
type AgentWorkflowEvent,
type AgentWorkflowStep,
} from "ayjnt/workflows";
type Params = { documentId: string };
export default class ReviewWorkflow extends AgentWorkflow<Params> {
async run(
event: Readonly<AgentWorkflowEvent<Params>>,
step: AgentWorkflowStep,
) {
const result = await step.do("analyze", async () => {
return analyze(event.payload.documentId);
});
await step.reportComplete(result);
return result;
}
}Start it from the agent
Co-location is the relationship: extend Ayjnt’s Agent and call this.workflow(params). Generated declarations carry the workflow payload type into the agent, so there is no agent-name generic, mixin, or binding string to repeat.
import { Agent, callable } from "ayjnt";
export default class ReviewAgent extends Agent {
@callable()
async start(documentId: string) {
return this.workflow({ documentId });
}
}Run it and verify the result
Start the workflow from the agent UI and watch the workflow ID, durable steps, and completion callback appear.
bun run build
bun run dev
# the local app is now available at http://localhost:8787