Agent Orchestration
Chain complex multi-agent workflows with built-in error handling and retry logic - no more brittle synchronous calls between your AI agents.
import { generateText } from "ai"
import { openai } from "@ai-sdk/openai"
await sailhouse.subscribe('security-review', async ({event}) => {
const { pull_request_id, org } = event;
const pullRequestData = await getPullRequestForOrg(org, pull_request_id);
const { text } = await generateText({
model: openai("o3-mini"),
prompt: `Review this pull request for security vulnerabilities: ${pullRequestData.diff}`
});
});
Wait groups
Wait groups allow you to run tasks in parallel, and be notified when they’re all complete. No need for your own state machines, with built-in error handling and retry logic.
const event = {
pull_request_id: pullRequest.id,
org: pullRequest.organisation.id
}
// When we've completed our security and code reviews,
// send an event to `pull-request-reviewed`
await sailhouse.wait(
"pull-request-reviewed",
[
{ topic: "security-review", event },
{ topic: "code-review", event },
]
);
Scheduled intelligence
Make your agents smarter with scheduled intelligence. Queue prompts and agent tasks to run at specific times or after delays - ideal for follow-ups, periodic analysis, or time-sensitive workflows.
await sailhouse.publish('check-telemetry', {
query: "logs |> level == 'error'",
}, {
// Check telemetry again in 15 minutes
send_at: new Date(Date.now() + 1000 * 60 * 15)
})