Skip to content

Instantly share code, notes, and snippets.

@anton-pt
Created June 30, 2025 15:20
Show Gist options
  • Select an option

  • Save anton-pt/ca9cacf3f67ae4256c34f96297a9922d to your computer and use it in GitHub Desktop.

Select an option

Save anton-pt/ca9cacf3f67ae4256c34f96297a9922d to your computer and use it in GitHub Desktop.
MeetQu service using Restate
export const MeetQuService = restate.service({
name: 'MeetQuService',
handlers: {
runSearch: restate.handlers.handler(
async (ctx: restate.Context, request): Promise<SearchContext> => {
// Generate short bio in parallel with main pipeline
const shortBioPromise = ctx
.serviceClient(MeetQuService)
.generateShortBio(request);
// Generate full research brief
const fullResearchBrief = await ctx
.serviceClient(MeetQuService)
.generateFullResearchBrief(request);
const requestWithBrief = { ...request, fullResearchBrief };
// Generate all insights in parallel
const [connectOverInsights, talkAboutInsights, keepInMindInsights] =
await restate.RestatePromise.all([
ctx.serviceClient(MeetQuService)
.generateConnectOverInsights(requestWithBrief),
ctx.serviceClient(MeetQuService)
.generateTalkAboutInsights(requestWithBrief),
ctx.serviceClient(MeetQuService)
.generateKeepInMindInsights(requestWithBrief),
]);
// Wait for both compiled insights and short bio
const [compiledInsights, shortBio] = await restate.RestatePromise.all([
ctx.serviceClient(MeetQuService).generateCompiledInsights({
...requestWithBrief,
connectOverInsights,
talkAboutInsights,
keepInMindInsights,
}),
shortBioPromise,
]);
return {
...requestWithBrief,
connectOverInsights,
talkAboutInsights,
keepInMindInsights,
compiledInsights,
shortBio,
};
}
),
// ... individual step handlers
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment