Skip to content

SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]

Breaking: Move problem_statement and repo configs

Kilian Lieret2f8b24266711
diff --git a/docs/reference/problem_statements.md b/docs/reference/problem_statements.md
index 8d0a4aed..26c7e3ef 100644
--- a/docs/reference/problem_statements.md
+++ b/docs/reference/problem_statements.md
@@ -28,30 +28,30 @@ For example:
See below for more details on the configuration options.
-All of these classes are defined in `sweagent.environment.config.problem_statement`.
+All of these classes are defined in `sweagent.agent.problem_statement`.
-::: sweagent.environment.config.problem_statement.problem_statement_from_simplified_input
+::: sweagent.agent.problem_statement.problem_statement_from_simplified_input
options:
show_root_full_path: false
show_bases: false
-::: sweagent.environment.config.problem_statement.TextProblemStatement
+::: sweagent.agent.problem_statement.TextProblemStatement
options:
show_root_full_path: false
show_bases: false
-::: sweagent.environment.config.problem_statement.FileProblemStatement
+::: sweagent.agent.problem_statement.FileProblemStatement
options:
show_root_full_path: false
show_bases: false
-::: sweagent.environment.config.problem_statement.GithubIssue
+::: sweagent.agent.problem_statement.GithubIssue
options:
show_root_full_path: false
show_bases: false
-::: sweagent.environment.config.problem_statement.EmptyProblemStatement
+::: sweagent.agent.problem_statement.EmptyProblemStatement
options:
show_root_full_path: false
show_bases: false
diff --git a/docs/reference/repo.md b/docs/reference/repo.md
index 7648962d..ef63226a 100644
--- a/docs/reference/repo.md
+++ b/docs/reference/repo.md
@@ -21,24 +21,24 @@ For example:
--env.repo.type=local
```
-All of these classes are defined in `sweagent.environment.config.repo`.
+All of these classes are defined in `sweagent.environment.repo`.
-::: sweagent.environment.config.repo.PreExistingRepoConfig
+::: sweagent.environment.repo.PreExistingRepoConfig
options:
show_root_full_path: false
show_bases: false
-::: sweagent.environment.config.repo.LocalRepoConfig
+::: sweagent.environment.repo.LocalRepoConfig
options:
show_root_full_path: false
show_bases: false
-::: sweagent.environment.config.repo.GithubRepoConfig
+::: sweagent.environment.repo.GithubRepoConfig
options:
show_root_full_path: false
show_bases: false
-::: sweagent.environment.config.repo.repo_from_simplified_input
+::: sweagent.environment.repo.repo_from_simplified_input
options:
show_root_full_path: false
show_bases: false
diff --git a/docs/usage/cl_tutorial.md b/docs/usage/cl_tutorial.md
index 40d97186..34ff9014 100644
--- a/docs/usage/cl_tutorial.md
+++ b/docs/usage/cl_tutorial.md
@@ -154,9 +154,9 @@ problem_statement: TextProblemStatement | GithubIssue | FileProblemStatement #
Each of these configuration objects has its own set of options:
-* [`GithubIssue`](../reference/problem_statements.md#sweagent.environment.config.problem_statement.GithubIssue)
-* [`TextProblemStatement`](../reference/problem_statements.md#sweagent.environment.config.problem_statement.TextProblemStatement)
-* [`FileProblemStatement`](../reference/problem_statements.md#sweagent.environment.config.problem_statement.FileProblemStatement)
+* [`GithubIssue`](../reference/problem_statements.md#sweagent.agent.problem_statement.GithubIssue)
+* [`TextProblemStatement`](../reference/problem_statements.md#sweagent.agent.problem_statement.TextProblemStatement)
+* [`FileProblemStatement`](../reference/problem_statements.md#sweagent.agent.problem_statement.FileProblemStatement)
So how do we know which configuration object to initialize?
It's simple: Each of these types has a different set of required options (e.g., `github_url` is required for `GithubIssue`, but not for `TextProblemStatement`).
@@ -182,9 +182,9 @@ The repository can be specified in a few different ways:
Again, those are [union types](union-types). See here for all the options:
-* [`GithubRepoConfig`](../reference/repo.md#sweagent.environment.config.repo.GithubRepoConfig): Pull a repository from GitHub.
-* [`LocalRepoConfig`](../reference/repo.md#sweagent.environment.config.repo.LocalRepoConfig): Copies a repository from your local filesystem to the docker container.
-* [`PreExistingRepoConfig`](../reference/repo.md#sweagent.environment.config.repo.PreExistingRepoConfig): If you want to use a repository that already exists on the docker container.
+* [`GithubRepoConfig`](../reference/repo.md#sweagent.environment.repo.GithubRepoConfig): Pull a repository from GitHub.
+* [`LocalRepoConfig`](../reference/repo.md#sweagent.environment.repo.LocalRepoConfig): Copies a repository from your local filesystem to the docker container.
+* [`PreExistingRepoConfig`](../reference/repo.md#sweagent.environment.repo.PreExistingRepoConfig): If you want to use a repository that already exists on the docker container.
## Taking actions
diff --git a/sweagent/agent/agents.py b/sweagent/agent/agents.py
index 264450b9..d3e87605 100644
--- a/sweagent/agent/agents.py
+++ b/sweagent/agent/agents.py
@@ -26,7 +26,7 @@ from sweagent.agent.models import (
ModelConfig,
get_model,
)
-from sweagent.environment.config.problem_statement import ProblemStatement, ProblemStatementConfig
+from sweagent.agent.problem_statement import ProblemStatement, ProblemStatementConfig
from sweagent.environment.swe_env import SWEEnv
from sweagent.exceptions import ContextWindowExceededError, CostLimitExceededError, FormatError
from sweagent.tools.parsing import (
diff --git a/sweagent/environment/config/problem_statement.py b/sweagent/agent/problem_statement.py
similarity index 100%
rename from sweagent/environment/config/problem_statement.py
rename to sweagent/agent/problem_statement.py
diff --git a/sweagent/api/server.py b/sweagent/api/server.py
index 30513966..0f3f2ad0 100644
--- a/sweagent/api/server.py
+++ b/sweagent/api/server.py
@@ -16,10 +16,10 @@ from flask_cors import CORS
from flask_socketio import SocketIO
from sweagent import CONFIG_DIR, PACKAGE_DIR
+from sweagent.agent.problem_statement import problem_statement_from_simplified_input
from sweagent.api.hooks import AgentUpdateHook, EnvUpdateHook, MainUpdateHook, WebUpdate
from sweagent.api.utils import AttrDict, ThreadWithExc
-from sweagent.environment.config.problem_statement import problem_statement_from_simplified_input
-from sweagent.environment.config.repo import repo_from_simplified_input
+from sweagent.environment.repo import repo_from_simplified_input
# baaaaaaad
sys.path.append(str(PACKAGE_DIR.parent))
diff --git a/sweagent/environment/config/__init__.py b/sweagent/environment/config/__init__.py
deleted file mode 100644
index e69de29b..00000000
diff --git a/sweagent/environment/hooks/abstract.py b/sweagent/environment/hooks/abstract.py
index 78ddd2d3..33ac5c69 100644
--- a/sweagent/environment/hooks/abstract.py
+++ b/sweagent/environment/hooks/abstract.py
@@ -1,4 +1,4 @@
-from sweagent.environment.config.repo import Repo, RepoConfig
+from sweagent.environment.repo import Repo, RepoConfig
class EnvHook:
diff --git a/sweagent/environment/hooks/status.py b/sweagent/environment/hooks/status.py
index 00dbd3b4..8926920f 100644
--- a/sweagent/environment/hooks/status.py
+++ b/sweagent/environment/hooks/status.py
@@ -1,7 +1,7 @@
from collections.abc import Callable
-from sweagent.environment.config.repo import Repo, RepoConfig
from sweagent.environment.hooks.abstract import EnvHook
+from sweagent.environment.repo import Repo, RepoConfig
class SetStatusEnvironmentHook(EnvHook):
diff --git a/sweagent/environment/config/repo.py b/sweagent/environment/repo.py
similarity index 100%
rename from sweagent/environment/config/repo.py
rename to sweagent/environment/repo.py
diff --git a/sweagent/environment/swe_env.py b/sweagent/environment/swe_env.py
index ad609f38..4b86f4f5 100644
--- a/sweagent/environment/swe_env.py
+++ b/sweagent/environment/swe_env.py
@@ -9,8 +9,8 @@ from swerex.deployment.abstract import AbstractDeployment
from swerex.deployment.config import DeploymentConfig, DockerDeploymentConfig, get_deployment
from swerex.runtime.abstract import BashAction, BashInterruptAction, CreateBashSessionRequest
-from sweagent.environment.config.repo import Repo, RepoConfig
from sweagent.environment.hooks.abstract import CombinedEnvHooks, EnvHook
+from sweagent.environment.repo import Repo, RepoConfig
from sweagent.utils.log import get_logger
diff --git a/sweagent/run/batch_instances.py b/sweagent/run/batch_instances.py
index 484a346f..0a8f45fc 100644
--- a/sweagent/run/batch_instances.py
+++ b/sweagent/run/batch_instances.py
@@ -15,8 +15,8 @@ from swerex.deployment.config import (
)
from typing_extensions import Self
-from sweagent.environment.config.problem_statement import ProblemStatementConfig, TextProblemStatement
-from sweagent.environment.config.repo import GithubRepoConfig, LocalRepoConfig, PreExistingRepoConfig
+from sweagent.agent.problem_statement import ProblemStatementConfig, TextProblemStatement
+from sweagent.environment.repo import GithubRepoConfig, LocalRepoConfig, PreExistingRepoConfig
from sweagent.environment.swe_env import EnvironmentConfig
from sweagent.utils.log import get_logger
diff --git a/sweagent/run/hooks/abstract.py b/sweagent/run/hooks/abstract.py
index ce89c6d0..b0074f28 100644
--- a/sweagent/run/hooks/abstract.py
+++ b/sweagent/run/hooks/abstract.py
@@ -1,4 +1,4 @@
-from sweagent.environment.config.problem_statement import ProblemStatement, ProblemStatementConfig
+from sweagent.agent.problem_statement import ProblemStatement, ProblemStatementConfig
from sweagent.environment.swe_env import SWEEnv
from sweagent.types import AgentRunResult
diff --git a/sweagent/run/hooks/apply_patch.py b/sweagent/run/hooks/apply_patch.py
index dde265a0..8d2614ba 100644
--- a/sweagent/run/hooks/apply_patch.py
+++ b/sweagent/run/hooks/apply_patch.py
@@ -5,8 +5,8 @@ import rich
import rich.markdown
import rich.panel
-from sweagent.environment.config.problem_statement import ProblemStatementConfig
-from sweagent.environment.config.repo import LocalRepoConfig
+from sweagent.agent.problem_statement import ProblemStatementConfig
+from sweagent.environment.repo import LocalRepoConfig
from sweagent.environment.swe_env import SWEEnv
from sweagent.run.common import _is_promising_patch
from sweagent.run.hooks.abstract import RunHook
diff --git a/sweagent/run/run_single.py b/sweagent/run/run_single.py
index 8338553e..a4eff44f 100644
--- a/sweagent/run/run_single.py
+++ b/sweagent/run/run_single.py
@@ -37,7 +37,7 @@ from pydantic import BaseModel, ConfigDict, Field
from pydantic_settings import BaseSettings
from sweagent.agent.agents import Agent, AgentConfig
-from sweagent.environment.config.problem_statement import (
+from sweagent.agent.problem_statement import (
EmptyProblemStatement,
ProblemStatement,
ProblemStatementConfig,
diff --git a/tests/conftest.py b/tests/conftest.py
index 4aee2dfc..b1314fa3 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -11,7 +11,7 @@ from pathlib import Path
import pytest
from swerex.deployment.config import DockerDeploymentConfig, DummyDeploymentConfig
-from sweagent.environment.config.repo import LocalRepoConfig
+from sweagent.environment.repo import LocalRepoConfig
from sweagent.environment.swe_env import EnvironmentConfig, SWEEnv
# this is a hack and should be removed when we have a better solution
diff --git a/tests/test_agent.py b/tests/test_agent.py
index 18fc2e6f..6a942ac2 100644
--- a/tests/test_agent.py
+++ b/tests/test_agent.py
@@ -7,7 +7,7 @@ from swerex.runtime.dummy import DummyRuntime
from sweagent import CONFIG_DIR
from sweagent.agent.agents import Agent, AgentConfig
from sweagent.agent.models import InstantEmptySubmitModelConfig, PredeterminedTestModel
-from sweagent.environment.config.problem_statement import EmptyProblemStatement, TextProblemStatement
+from sweagent.agent.problem_statement import EmptyProblemStatement, TextProblemStatement
from sweagent.environment.swe_env import SWEEnv
from sweagent.tools.parsing import FunctionCallingParser, Identity, ThoughtActionParser
from sweagent.tools.tools import ToolConfig
diff --git a/tests/test_batch_instance.py b/tests/test_batch_instance.py
index b351f3bd..c1184f85 100644
--- a/tests/test_batch_instance.py
+++ b/tests/test_batch_instance.py
@@ -3,8 +3,8 @@ import json
import pytest
from swerex.deployment.config import DockerDeploymentConfig
-from sweagent.environment.config.problem_statement import TextProblemStatement
-from sweagent.environment.config.repo import PreExistingRepoConfig
+from sweagent.agent.problem_statement import TextProblemStatement
+from sweagent.environment.repo import PreExistingRepoConfig
from sweagent.run.batch_instances import BatchInstance, SimpleBatchInstance, SWEBenchInstances, _slice_spec_to_slice