Skip to content

Commit cbf6b04

Browse files
authored
feat: enable AWS Bedrock fallback for wizard agent requests (#439)
1 parent 44bac37 commit cbf6b04

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/lib/agent/agent-interface.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,13 +380,16 @@ export function buildWizardMetadata(
380380
}
381381

382382
/**
383-
* Build env for the SDK subprocess: process.env plus ANTHROPIC_CUSTOM_HEADERS from wizard metadata/flags.
383+
* Build env for the SDK subprocess: process.env plus ANTHROPIC_CUSTOM_HEADERS, which always
384+
* includes `x-posthog-use-bedrock-fallback: true` so the LLM gateway falls back to Bedrock on
385+
* Anthropic 5xx, plus any wizard metadata/flags.
384386
*/
385387
function buildAgentEnv(
386388
wizardMetadata: Record<string, string>,
387389
wizardFlags: Record<string, string>,
388390
): string {
389391
const headers = createCustomHeaders();
392+
headers.add('x-posthog-use-bedrock-fallback', 'true');
390393
for (const [key, value] of Object.entries(wizardMetadata)) {
391394
headers.add(
392395
key.startsWith(POSTHOG_PROPERTY_HEADER_PREFIX)

0 commit comments

Comments
 (0)