Repository navigation
feat: apify actor generate-schema — AI generates INPUT_SCHEMA.json from existing Actor code #1441
Copy link
Copy link
Open
Labels
t-buildersIssues owned by the Builders team.Issues owned by the Builders team.
Description
Problem
INPUT_SCHEMA.json is the most tedious part of publishing an Apify Actor. Developers typically:
- Write their Actor code with hardcoded or
process.env-style inputs - Manually inspect the code to figure out what inputs exist
- Hand-write
INPUT_SCHEMA.jsonfrom scratch, often getting field types or required flags wrong - Iterate because
apify validate-schemaor the platform build rejects it
This friction prevents many Actors from ever getting published with a proper schema.
Proposal
Add a new command that reads your Actor code and generates a draft INPUT_SCHEMA.json:
apify actor generate-schemaWhat it does
- Reads
src/main.js(ormain.py,src/main.ts, etc.) from the current Actor directory - Extracts input references:
input.url,Actor.getInput(),process.env.APIFY_*, argparse args, etc. - Sends the relevant code snippets to an LLM with a schema generation prompt
- Writes a draft
.actor/INPUT_SCHEMA.json - Runs
apify validate-schemaon the result and reports any issues
Example
$ apify actor generate-schema
Reading src/main.js...
Found input references:
input.startUrl (string, used in fetch call)
input.maxPages (number, default 10)
input.proxyConfig (object, passed to ProxyConfiguration)
Generating INPUT_SCHEMA.json...
✓ Written to .actor/INPUT_SCHEMA.json
Validating...
✓ Schema is valid
Review .actor/INPUT_SCHEMA.json and adjust descriptions before pushing.Generated schema (example)
{
"title": "My Actor",
"description": "Auto-generated schema — review before publishing",
"type": "object",
"schemaVersion": 1,
"properties": {
"startUrl": {
"title": "Start URL",
"type": "string",
"description": "The URL to start scraping from",
"editor": "textfield"
},
"maxPages": {
"title": "Max pages",
"type": "integer",
"description": "Maximum number of pages to scrape",
"default": 10
}
},
"required": ["startUrl"]
}Why it matters
- Schema creation is the single biggest friction point before publishing
- Removes the need to know the full JSON Schema + Apify schema extensions spec
- Increases the number of Actors published with proper schemas (better discoverability, better MCP tool descriptions)
- Natural complement to
apify create --from-url(feat: apify create --from-url <website> — AI generates Actor scaffold from a target URL #1440) andapify actors expose-as-mcp(feat: expose any Actor as an MCP tool — apify actors expose-as-mcp #1439)
Open questions
- Which LLM / API to call (Apify-hosted vs user brings API key)?
- Support for Python (
Actor.get_input(),typer,argparse)? - Should it update an existing schema or only create from scratch?
Related
- feat: apify create --from-url <website> — AI generates Actor scaffold from a target URL #1440 —
apify create --from-url(AI scaffold generation) - feat: expose any Actor as an MCP tool — apify actors expose-as-mcp #1439 — expose Actor as MCP tool (uses INPUT_SCHEMA for tool description)
- apify validate-schema passes schemas the platform build rejects #1364 —
apify validate-schemapasses schemas the platform rejects (validation gap) - generate-schema-types: support directory path as argument #1033 (closed) — generate-schema-types (type gen from schema, not schema from code)
Metadata
Metadata
Assignees
Labels
t-buildersIssues owned by the Builders team.Issues owned by the Builders team.
Activity