import { createStreamingClient } from "@textql/sdk/streaming";
import { AgentRunStatus } from "@textql/sdk/generated/connect/public/agent_pb.js";
const streaming = createStreamingClient({ apiKey });
for await (const update of streaming.agents.streamAgentStatus({})) {
if (update.status === AgentRunStatus.RUNNING) {
setRunning(update.agentId, update.summary); // live progress summary
}
if (update.status === AgentRunStatus.DONE) {
linkResult(update.agentId, update.chatId); // the run's chat
}
}