import express from "express";
import { Agent, Team, TeamMode, Workflow, openai } from "@radaros/core";
import { createAgentRouter } from "@radaros/transport";
const researcher = new Agent({
name: "researcher",
model: openai("gpt-4o-mini"),
instructions: "Research the given topic.",
});
const writer = new Agent({
name: "writer",
model: openai("gpt-4o"),
instructions: "Write a polished article from research notes.",
});
const team = new Team({
name: "content-team",
agents: [researcher, writer],
mode: TeamMode.SEQUENTIAL,
instructions: "Research a topic, then write an article about it.",
});
const workflow = new Workflow({
name: "publish-pipeline",
steps: [
{ type: "agent", agent: researcher, input: "Research AI trends" },
{ type: "agent", agent: writer },
],
});
const app = express();
app.use(express.json());
app.use(
"/api",
createAgentRouter({
agents: { researcher, writer },
teams: { "content-team": team },
workflows: { "publish-pipeline": workflow },
swagger: { enabled: true, title: "Content Platform API" },
}),
);
app.listen(3000);
// POST /api/teams/content-team/run { "input": "Write about quantum computing" }
// POST /api/teams/content-team/stream (SSE)
// POST /api/workflows/publish-pipeline/run