Chat base. You describe what the agent is, meaning its model, system prompts, tools, and middleware, and the base class owns how those pieces are wired into the agent loop. You never call the model directly.
The four getters
Every agent implements exactly four abstract getters:
Tools and middleware are returned as class references, not instances. The base class resolves each one from the DI container on demand, so any constructor dependencies are injected for you.
Return empty arrays for
getTools and getMiddlewares when you don’t need them. Both getters are required even when the agent is a plain chat.Registering with the container
Thedecorator.chat() decorator registers the agent class with the container so it can be resolved and have its own dependencies injected: