Prerequisites
The following examples require theopenai library:
MORPH_API_KEY environment variable:
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
MorphTools provides advanced code editing capabilities using Morph’s Fast Apply API for intelligent code modifications.
openai library:
uv pip install -U openai
MORPH_API_KEY environment variable:
export MORPH_API_KEY="your-morph-api-key"
from agno.agent import Agent
from agno.tools.models.morph import MorphTools
agent = Agent(
instructions=[
"You are a code editing assistant using Morph's advanced AI capabilities",
"Help users modify, improve, and refactor their code intelligently",
"Apply code changes efficiently while maintaining code quality",
"Provide explanations for the modifications made",
],
tools=[MorphTools()],
)
agent.print_response("Refactor this Python function to be more efficient and add type hints", stream=True)
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key | Optional[str] | None | Morph API key. Uses MORPH_API_KEY if not set. |
base_url | str | "https://api.morphllm.com/v1" | Morph API base URL. |
model | str | "morph-v3-large" | Morph model to use for code editing. |
instructions | Optional[str] | None | Custom instructions for code editing behavior. |
add_instructions | bool | True | Whether to add instructions to the agent. |
| Function | Description |
|---|---|
edit_file | Apply intelligent code modifications using Morph’s Fast Apply API. |
Was this page helpful?