| 1 | # Python bindings
|
| 2 |
|
| 3 | !!! abstract "Overview"
|
| 4 |
|
| 5 | This page shows the most basic example of how to use mini-SWE-agent as a Python library.
|
| 6 | For more advanced usage, subclassing, and mix & match of components, see [subclassing and more](../advanced/cookbook.md).
|
| 7 |
|
| 8 | ## Hello world
|
| 9 |
|
| 10 | ```python
|
| 11 | import logging
|
| 12 |
|
| 13 | from minisweagent.agents.default import DefaultAgent
|
| 14 | from minisweagent.models import get_model
|
| 15 | from minisweagent.environments.local import LocalEnvironment
|
| 16 |
|
| 17 | logging.basicConfig(level=logging.DEBUG)
|
| 18 | task = "Write a hello world program"
|
| 19 | model_name = "anthropic/claude-sonnet-4-5-20250929"
|
| 20 |
|
| 21 | agent = DefaultAgent(
|
| 22 | get_model(input_model_name=model_name),
|
| 23 | LocalEnvironment(),
|
| 24 | )
|
| 25 |
|
| 26 | # Run the agent
|
| 27 | agent.run(task)
|
| 28 | ```
|
| 29 |
|
| 30 | {% include-markdown "../_footer.md" %}
|
| 31 |
|