← Back to homepage

Generate Python Code

Draft ArcPy snippets tailored to your active map by describing the task you want automated. Optionally include layer samples so the AI can see schemas and representative data.

Usage

  1. Add the toolbox to ArcGIS Pro.
  2. Open Generate Python Code.
  3. Pick a provider/model, set context layers, and describe the script you need.
  4. Run the tool and copy the generated code from the messages pane.

Parameters

NameTypeRequiredDescription
SourceString (Choice)YesAI provider (OpenRouter, OpenAI, Azure OpenAI, Claude, DeepSeek, Local LLM).
ModelStringNoSpecific model to use.
EndpointStringNoCustom endpoint for Azure or local deployments.
Deployment NameStringNoAzure OpenAI deployment ID.
Layers for ContextFeature Layer (MultiValue)NoOptional layers to share schema and the first five records with the AI.
PromptStringYesDescribe the script you need. Specific inputs and outputs improve quality.
ContextStringNoAutomatically generated map summary, similar to the Get Map Info output.

Tips

Data privacy

Important: Any layers you include for context (schema plus sample rows) get sent to the provider you choose. Make sure this is allowed for your dataset, or stick to local models.