Aviary
Recipes

Recipes

Copy-pasteable cookbook for @dudousxd/nestjs-agent — a hand-rolled ModelProvider, flipping the inline runner to durable, DI-powered functional tools, a billing export off the governance read-model, and exercising the whole loop offline.

Every recipe here is a complete, working example built against the real SPIs — the same interfaces the shipped adapters (aiSdkModel, the MikroORM/Drizzle stores, InlineAgentRunner) implement. Read the problem statement, copy the code, adapt the clearly-marked sketch parts to your stack.

RecipeWhen you reach for it
Custom ModelProviderYou're not going through the Vercel AI SDK — implement the ModelProvider SPI by hand against your own gateway or client, streaming to the sink and returning tool calls without ever executing them.
Inline → durableYou started with the in-process runner and now want checkpointed, replay-safe turns and a real HITL suspend — flip durable: true, same wire protocol.
Functional tools with DIA tool needs constructor-injected dependencies but you don't want a whole @AiTool class — register it as data + handler via provideAgentTool.
Billing exportBeyond the shipped dashboard/telescope surfaces, you want your own CSV/JSON spend export off the same governance read-model.
Offline testingUnit- or e2e-test tool calling, HITL approval, and multi-agent delegation with zero API key, zero Redis, fully in-memory.

Each recipe links back to the concept or guide page that explains the mechanism — the recipes are the how, the guides are the why.