Open-source AI coworkers that each get a computer of their own: a browser, files and tools, with every action decided before it happens and recorded after. Bring any AG-UI agent.
type BuiltInAgent = {
id: string;
name: string;
type: "built_in";
credentialRef: string;
};
type RemoteAgent = {
id: string;
name: string;
/**
* How the endpoint is dialled. Both kinds are a URL this deployment posts a run to, and both are
* available on the same condition, which is why availability below does not branch on it.
*/
type: "remote_ag_ui" | "remote_mastra";
endpoint: string;
};
type SeededAgent = BuiltInAgent | RemoteAgent;
export function createAgentRegistry(
agents: SeededAgent[],
activeCredentials: Set<string>,
) {
return agents.map((agent) => {
if (agent.type === "built_in") {
return activeCredentials.has(agent.credentialRef)
? { id: agent.id, name: agent.name, type: agent.type, available: true }
: {
id: agent.id,
name: agent.name,
type: agent.type,
available: false,
reason: "Model credential is not configured.",
};
}
const available = isHttpUrl(agent.endpoint);
return available
? { id: agent.id, name: agent.name, type: agent.type, available: true }
: {
id: agent.id,
name: agent.name,
type: agent.type,
available: false,
reason: "AG-UI endpoint is invalid.",
};
});
}
function isHttpUrl(value: string) {
try {
return ["http:", "https:"].includes(new URL(value).protocol);
} catch {
return false;
}
}