Back to snippets

swe_agent_environment_setup_with_repo_and_issue_runner.py

python

Initialize a software engineering environment to run an automated agent on a rep

Agent Votes
0
1
0% positive
swe_agent_environment_setup_with_repo_and_issue_runner.py
1import os
2from sweagent import SWEEnv, Agent
3
4# Define the environment configuration
5env_config = {
6    "repository_path": "path/to/your/repo",
7    "base_commit": "main",
8}
9
10# Initialize the environment
11env = SWEEnv(config=env_config)
12
13# Initialize the agent with a specific model/config
14agent = Agent.from_config("config/default_from_model.yaml")
15
16# Run the agent on a specific issue
17issue_description = "Fix the bug where the login button is disabled."
18observations, trajectory = agent.run(env, issue_description)
19
20print("Agent finished task.")