Get started with Morph in minutes
Prerequisite: You’ll need an account on Morph to obtain an API key.
Click here for a prompt for your AI IDE
Configure your AI agent with the proper system prompt to handle code editing effectively:
System Prompt Configuration
Add this to your AI agent’s system prompt:
These prompts ensure your agent:
Implement the edit_file tool in your AI agent with the proper prompt and schema:
Tool Description:
Parameters:
target_file
(string, required): The target file to modifycode_edit
(string, required): Specify ONLY the precise lines of code that you wish to edit. Use // ... existing code ...
for unchanged sections.Tool Description:
Parameters:
target_file
(string, required): The target file to modifycode_edit
(string, required): Specify ONLY the precise lines of code that you wish to edit. Use // ... existing code ...
for unchanged sections.Tool Definition:
Example Good Edit Pattern:
Best Practices:
// ... existing code ...
to indicate unchanged sectionsWhen your agent calls the edit_file tool, send the original file content and update snippet to Morph:
View our OpenAI-compatible API
API Base URL:
Implementation Example:
Input Format:
The Morph API expects two key components:
<code>...</code>
tags<update>...</update>
tagsThe update snippet should use truncation markers like // ... existing code ...
to indicate unchanged parts of the code.
Why Morph?
Morph’s apply model offers significant advantages over search/replace or full file rewriting:
For access to our latest models, self-hosting, or business inquiries, please contact us at info@morphllm.com.
Get started with Morph in minutes
Prerequisite: You’ll need an account on Morph to obtain an API key.
Click here for a prompt for your AI IDE
Configure your AI agent with the proper system prompt to handle code editing effectively:
System Prompt Configuration
Add this to your AI agent’s system prompt:
These prompts ensure your agent:
Implement the edit_file tool in your AI agent with the proper prompt and schema:
Tool Description:
Parameters:
target_file
(string, required): The target file to modifycode_edit
(string, required): Specify ONLY the precise lines of code that you wish to edit. Use // ... existing code ...
for unchanged sections.Tool Description:
Parameters:
target_file
(string, required): The target file to modifycode_edit
(string, required): Specify ONLY the precise lines of code that you wish to edit. Use // ... existing code ...
for unchanged sections.Tool Definition:
Example Good Edit Pattern:
Best Practices:
// ... existing code ...
to indicate unchanged sectionsWhen your agent calls the edit_file tool, send the original file content and update snippet to Morph:
View our OpenAI-compatible API
API Base URL:
Implementation Example:
Input Format:
The Morph API expects two key components:
<code>...</code>
tags<update>...</update>
tagsThe update snippet should use truncation markers like // ... existing code ...
to indicate unchanged parts of the code.
Why Morph?
Morph’s apply model offers significant advantages over search/replace or full file rewriting:
For access to our latest models, self-hosting, or business inquiries, please contact us at info@morphllm.com.