feat: Recompile system prompt after memory subagents finish (#1310)

This commit is contained in:
Devansh Jain
2026-03-09 16:50:40 -07:00
committed by GitHub
parent f5d6f095a6
commit 89d6ed2c87
9 changed files with 547 additions and 52 deletions

View File

@@ -247,6 +247,45 @@ export async function updateConversationLLMConfig(
return client.conversations.update(conversationId, payload);
}
export interface RecompileAgentSystemPromptOptions {
dryRun?: boolean;
updateTimestamp?: boolean;
}
interface AgentSystemPromptRecompileClient {
agents: {
recompile: (
agentId: string,
params: {
dry_run?: boolean;
update_timestamp?: boolean;
},
) => Promise<string>;
};
}
/**
* Recompile an agent's system prompt after memory writes so server-side prompt
* state picks up the latest memory content.
*
* @param agentId - The agent ID to recompile
* @param options - Optional dry-run/timestamp controls
* @param clientOverride - Optional injected client for tests
* @returns The compiled system prompt returned by the API
*/
export async function recompileAgentSystemPrompt(
agentId: string,
options: RecompileAgentSystemPromptOptions = {},
clientOverride?: AgentSystemPromptRecompileClient,
): Promise<string> {
const client = clientOverride ?? (await getClient());
return client.agents.recompile(agentId, {
dry_run: options.dryRun,
update_timestamp: options.updateTimestamp,
});
}
export interface SystemPromptUpdateResult {
success: boolean;
message: string;