Documentation
¶
Overview ¶
Command features-app-resources shows pipeline.WorkerConfig.AppResources.
AppResources is whatever the application wants to share across a session: database handles, HTTP clients, feature flags, per-user state, observability clients, in-memory caches. The framework passes it through untouched and exposes it as the worker's AppResources, so any code with a handle on the worker can read or change it.
Two of the read sites are shown here:
- Tool handlers read it from llm.FunctionCallParams.AppResources.
- Custom processors read it from Running().AppResources().
Two small loggers stand in for the shared thing: a toolCallLogger written from the tool handlers, and a transcriptionLogger written from a custom processor in the pipeline. A real application might pass a database pool, a Redis client or an SDK client just as well. The mechanics are the same whatever goes in: build it once, hand it to the worker, read it at each site, inspect it after the session.
The resources are bundled in a typed appResources struct and asserted back to it at each read site. The worker does not care what type it is given, but a typed container is safer than lookups by string key.
DEEPGRAM_API_KEY=… CARTESIA_API_KEY=… OPENAI_API_KEY=… \ go run ./examples/features/features-app-resources
Then open http://localhost:7860, connect, and ask about the weather.