Example

The following agent can perform intelligent code editing using Morph:
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)

Toolkit Params

ParameterTypeDefaultDescription
api_keyOptional[str]NoneMorph API key. Uses MORPH_API_KEY if not set.
base_urlstr"https://api.morphllm.com/v1"Morph API base URL.
modelstr"morph-v3-large"Morph model to use for code editing.
instructionsOptional[str]NoneCustom instructions for code editing behavior.
add_instructionsboolTrueWhether to add instructions to the agent.

Toolkit Functions

FunctionDescription
edit_fileApply intelligent code modifications using Morph’s Fast Apply API.

Developer Resources