Integration Patterns
Embed in a Node App
Recommended pattern for creating and using a local Agent directly inside a Node.js application
Embed in a Node App
This is the most natural SDK usage pattern:
- your application code creates
Agentdirectly - the app prepares a session at startup
- a handler turns incoming requests into
session.prompt()
Good fit for:
- internal tools
- MCP-style wrappers
- project-oriented engineering assistant services
Its biggest advantages are:
- full local context
- direct debugging
- no cross-process networking problems to solve first
Packaging behavior
The built-in system prompts and init templates in @downcity/agent are now compiled directly into TypeScript modules.
That means:
- you do not need to copy extra runtime text assets such as
PROMPT.txt - embedding the SDK into Electron main or another Node host no longer depends on preserving a prompt file directory structure
- as long as your runtime can load the ESM entry of
@downcity/agent, prompt asset path issues will not block startup