> ## Documentation Index
> Fetch the complete documentation index at: https://phidatainc-redirect-agent-platform-overview.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Morph

> MorphTools provides advanced code editing capabilities using Morph's Fast Apply API for intelligent code modifications.

## Example

The following agent can perform intelligent code editing using Morph:

```python theme={null}
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

| 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.       |

## Toolkit Functions

| Function    | Description                                                        |
| ----------- | ------------------------------------------------------------------ |
| `edit_file` | Apply intelligent code modifications using Morph's Fast Apply API. |

## Developer Resources

* View [Tools Source](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/tools/models/morph.py)
* [Morph API Documentation](https://docs.morphllm.com/)
* [Fast Apply API Reference](https://api.morphllm.com/docs)
