When using the OnUserPromptSubmitted hook and returning a UserPromptSubmittedHookOutput with AdditionalContext set, the context is not injected into the conversation for the model. The hook fires correctly (confirmed via logging), but the model does not receive the additional context.
Using ModifiedPrompt on the same hook output works as expected — the model sees the modified prompt. This suggests the issue is specifically with AdditionalContext handling in the CLI runtime.
- Configure a BYOK provider (Azure OpenAI):
var session = await client.CreateSessionAsync(new SessionConfig
{
Model = "gpt-5.2-chat",
Provider = new ProviderConfig
{
Type = "azure",
BaseUrl = "https://<endpoint>.openai.azure.com/openai/deployments/gpt-5.2-chat",
ApiKey = "<key>",
Azure = new AzureOptions { ApiVersion = "2024-12-01-preview" },
},
Streaming = true,
Hooks = new SessionHooks
{
OnUserPromptSubmitted = (input, invocation) =>
{
Console.WriteLine($"Hook fired: {invocation.SessionId}");
return Task.FromResult<UserPromptSubmittedHookOutput?>(
new UserPromptSubmittedHookOutput
{
AdditionalContext = "The user is currently viewing SDDC abc123 in region eastus2",
}
);
},
},
});
await session.SendAsync(new MessageOptions { Prompt = "What am I looking at?" });- The hook fires (confirmed via console output).
- The model responds as if it has no additional context — it does not know about the SDDC.
The AdditionalContext string should be injected into the conversation so the model can see it, as documented:
AdditionalContext- Additional context to inject into the conversation for the language model.