If a user gives an agent an OpenAPI file and says "make SDKs and docs," the agent should avoid the trap of generating code only. A real API launch needs packages, docs, examples, agent-readable files, release checks, and approval gates.
Step 1: validate the spec
Check:
- OpenAPI version is 3.0.x or 3.1.x.
info.titleandinfo.versionexist.- Every operation has an
operationId. - Auth is defined under
components.securitySchemes. - Responses include real schemas and examples.
- Path parameters are declared.
If this fails, use the OpenAPI validator before generating anything.
Step 2: package targets
Ask or infer:
- npm package name.
- PyPI package name.
- TypeScript import path.
- Python import module.
- Auth environment variable.
- README example endpoint.
Do not invent package names if there is an existing package.
Step 3: generate previews
Manual path:
- Generate TypeScript package.
- Run
tsc --noEmit, build,npm pack, and tarball install. - Generate Python package.
- Run
compileall, wheel build, and wheel install. - Generate docs from OpenAPI.
- Write
llms.txt, skill file, and MCP server manually or with separate tools.
Sourced path:
- Upload OpenAPI.
- Review TypeScript and Python client package artifacts.
- Review docs preview.
- Review skill-file draft.
- Review MCP server bundle.
- Review npm and PyPI readiness.
- Download artifacts and run local smoke checks if the user wants repo-level proof.
- Stop before publish/cutover unless the user approves the exact package, version, repo, and docs target.
Step 4: do not publish by accident
Publishing is a separate human-approved action. Previewing is safe. Dry-runs never publish packages or cut over docs, but they may read registry metadata and, when configured, dispatch non-publishing smoke-check CI. Real writes to npm, PyPI, GitHub, or docs DNS are not safe unless the user explicitly asks for that exact release.
Treat trusted publishing/OIDC as the preferred long-term registry path. Trusted publishing means a registry-trusted GitHub Actions workflow/OIDC publisher configured for the package or project. Do not paste long-lived npm or PyPI tokens into generated projects or chat logs. If the registry connection is missing, report the missing repo, workflow, or registry configuration and keep the run in preview/dry-run mode.
Agent output format
Return a compact report:
OpenAPI status:
Package targets:
Generated artifacts:
Smoke checks:
Docs preview:
Skill file:
MCP server:
Registry readiness:
Required approvals:
Sourced advantage
Sourced keeps these artifacts tied to one OpenAPI source. Agents can inspect the same run for docs, packages, skill files, MCP, and release readiness instead of reconciling five independent tools.