Hello World
Hello World run script
Full source code
import os
from pathlib import Path
import typer
import yaml
from minisweagent import package_dir
from minisweagent.agents.default import DefaultAgent
from minisweagent.environments.local import LocalEnvironment
from minisweagent.models.litellm_model import LitellmModel
app = typer.Typer()
@app.command()
def main(
task: str = typer.Option(..., "-t", "--task", help="Task/problem statement", show_default=False, prompt=True),
model_name: str = typer.Option(
os.getenv("MSWEA_MODEL_NAME"),
"-m",
"--model",
help="Model name (defaults to MSWEA_MODEL_NAME env var)",
prompt="What model do you want to use?",
),
) -> DefaultAgent:
agent = DefaultAgent(
LitellmModel(model_name=model_name),
LocalEnvironment(),
**yaml.safe_load(Path(package_dir / "config" / "default.yaml").read_text())["agent"],
)
agent.run(task)
return agent
if __name__ == "__main__":
app()
minisweagent.run.hello_world
app
module-attribute
app = Typer()
main
main(
task: str = Option(
...,
"-t",
"--task",
help="Task/problem statement",
show_default=False,
prompt=True,
),
model_name: str = Option(
getenv("MSWEA_MODEL_NAME"),
"-m",
"--model",
help="Model name (defaults to MSWEA_MODEL_NAME env var)",
prompt="What model do you want to use?",
),
) -> DefaultAgent
Source code in src/minisweagent/run/hello_world.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | |