A Next.js TypeScript API for managing AI agents, with automated documentation generation powered by TypeDoc.
| Method | Path | Description |
|---|---|---|
GET |
/api/health |
Health check |
GET |
/api/agents |
List agents (paginated) |
POST |
/api/agents |
Create a new agent |
GET |
/api/agents/:id |
Get agent by ID |
PUT |
/api/agents/:id |
Update an agent |
DELETE |
/api/agents/:id |
Delete an agent |
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build
# Run linter
npm run lintThis project includes an automated documentation pipeline that keeps API docs in sync across repositories.
- All TypeScript source files use TSDoc comments with
@param,@returns, and@exampleannotations. - TypeDoc (with the markdown plugin) generates documentation from these comments into a
docs/folder. - A GitHub Action (
.github/workflows/update-docs.yml) runs on every push tomain:- Generates fresh documentation via
npm run docs:generate - Clones the agent_doc repository
- Copies the generated markdown docs into the docs repo
- Creates a timestamped branch and opens a pull request
- Skips PR creation if no documentation has changed
- Generates fresh documentation via
# Generate docs locally
npm run docs:generate
# Serve generated docs
npm run docs:serveThe GitHub Action requires the following repository secret:
PAT_TOKEN— A GitHub Personal Access Token withreposcope, used to push branches and create PRs on the agent_doc repository.
├── src/
│ ├── app/
│ │ └── api/
│ │ ├── agents/
│ │ │ ├── route.ts # GET (list) / POST (create)
│ │ │ └── [id]/
│ │ │ └── route.ts # GET / PUT / DELETE by ID
│ │ └── health/
│ │ └── route.ts # Health check
│ ├── lib/
│ │ └── agents.ts # Data access layer
│ └── types/
│ └── agent.ts # TypeScript interfaces
├── .github/
│ └── workflows/
│ └── update-docs.yml # Docs pipeline
├── typedoc.json # TypeDoc configuration
├── tsconfig.json
└── package.json
- Runtime: Next.js 14+ (App Router)
- Language: TypeScript
- Documentation: TypeDoc + typedoc-plugin-markdown
- CI/CD: GitHub Actions