Summary
The prompt management SDK (@posthog/ai, and posthog-python) currently only supports fetching one prompt at a time via prompts.get(name). Retrieving N prompts means N separate calls. Add a way to fetch multiple prompts in a single request.
Why
Requested by a customer using @posthog/ai who is loading several prompts and would like to fetch them together rather than issuing one request per prompt. They noted this would be an improvement over competing tools (Langfuse doesn't offer batch fetching either), so it's a potential differentiator.
Benefits:
- Fewer round trips when an app depends on multiple prompts
- Simpler consuming code (no need to
Promise.all a set of individual get() calls)
- Shared client-side cache across the batch
Proposed shape
Something like a batch method that returns multiple compiled prompts in one call, keeping the existing single get() backwards-compatible:
const prompts = await client.prompts.getMany(['welcome', 'summary', 'followup'])
// prompts.welcome, prompts.summary, prompts.followup
Exact API/naming open to design — an array/comma-separated name param on a new method would work. Should reuse the existing caching and fallback behaviour.
Context
Raised via a support ticket about the newly released prompt configuration feature.
Created with PostHog from a Slack thread
Summary
The prompt management SDK (
@posthog/ai, andposthog-python) currently only supports fetching one prompt at a time viaprompts.get(name). Retrieving N prompts means N separate calls. Add a way to fetch multiple prompts in a single request.Why
Requested by a customer using
@posthog/aiwho is loading several prompts and would like to fetch them together rather than issuing one request per prompt. They noted this would be an improvement over competing tools (Langfuse doesn't offer batch fetching either), so it's a potential differentiator.Benefits:
Promise.alla set of individualget()calls)Proposed shape
Something like a batch method that returns multiple compiled prompts in one call, keeping the existing single
get()backwards-compatible:Exact API/naming open to design — an array/comma-separated name param on a new method would work. Should reuse the existing caching and fallback behaviour.
Context
Raised via a support ticket about the newly released prompt configuration feature.
Created with PostHog from a Slack thread