Swagger UI
RadarOS can generate an OpenAPI 3.0 spec and serve Swagger UI for your agent, team, and workflow endpoints. Enable it viaswagger.enabled in createAgentRouter() options.
Quick Enable
- Swagger UI at
/docs - OpenAPI spec at
/docs/spec.json
SwaggerOptions
Set to
true to enable Swagger UI and spec generation.API title shown in Swagger UI.
API description. Default: auto-generated from agents/teams/workflows.
API version string.
Route prefix used in path generation (e.g.,
/api). Paths in the spec will include this prefix.Server URLs for the OpenAPI spec. Useful for staging/production URLs.
Path to serve Swagger UI.
Path to serve the raw OpenAPI JSON spec.
Full Example
Dependencies
Swagger UI requiresswagger-ui-express:
swagger-ui-express is not installed, Swagger UI is disabled and a warning is logged.
Generated Spec
The OpenAPI spec includes:- Paths for each agent, team, and workflow
- Schemas for RunRequest, RunOutput, StreamChunk, MultipartRunRequest
- Per-agent structured output schemas — agents with
structuredOutputget a dedicated response schema (e.g.,RunOutput_analyst) that includes the full typedstructuredfield - Security schemes for provider-specific API keys (
x-openai-api-key,x-google-api-key,x-anthropic-api-key,x-api-key)
Structured Output in Swagger
If an agent has astructuredOutput Zod schema, RadarOS automatically converts it to JSON Schema and includes it in the OpenAPI spec. The structured field in the response is fully typed — API consumers see the exact shape of the data.
POST /agents/analyst/run will use the RunOutput_analyst schema with:
structuredOutput use the generic RunOutput schema where structured is untyped.