Configuring repositories
We currently support the following repository types:
- A pre-existing repository (
PreExistingRepoConfig
) - A local repository (
LocalRepoConfig
) - A GitHub repository (
GithubRepoConfig
)
With sweagent run
, you can specify the repository type with the --env.repo
flag.
For example:
--env.repo.repo_name="testbed" # (1)!
--env.repo.type=preexisting
- Folder name at the root of the deployment
--env.repo.path=/path/to/repo
--env.repo.type=local
All of these classes are defined in sweagent.environment.repo
.
PreExistingRepoConfig
pydantic-model
Use this to specify a repository that already exists on the deployment. This is important because we need to cd to the repo before running the agent.
Note: The repository must be at the root of the deployment.
Config:
extra
:'forbid'
Fields:
-
repo_name
(str
) -
base_commit
(str
) -
type
(Literal['preexisting']
)
base_commit
pydantic-field
base_commit: str = 'HEAD'
The commit to reset the repository to. The default is HEAD,
i.e., the latest commit. You can also set this to a branch name (e.g., dev
),
a tag (e.g., v0.1.0
), or a commit hash (e.g., a4464baca1f
).
SWE-agent will then start from this commit when trying to solve the problem.
repo_name
pydantic-field
repo_name: str
The repo name (the repository must be located at the root of the deployment).
type
pydantic-field
type: Literal['preexisting'] = 'preexisting'
Discriminator for (de)serialization/CLI. Do not change.
copy
copy(deployment: AbstractDeployment)
Does nothing.
Source code in sweagent/environment/repo.py
49 50 51 |
|
LocalRepoConfig
pydantic-model
Config:
extra
:'forbid'
Fields:
-
path
(Path
) -
base_commit
(str
) -
type
(Literal['local']
) -
repo_name
(str
)
base_commit
pydantic-field
base_commit: str = 'HEAD'
The commit to reset the repository to. The default is HEAD,
i.e., the latest commit. You can also set this to a branch name (e.g., dev
),
a tag (e.g., v0.1.0
), or a commit hash (e.g., a4464baca1f
).
SWE-agent will then start from this commit when trying to solve the problem.
path
pydantic-field
path: Path
repo_name
pydantic-field
repo_name: str
Set automatically based on the repository name. Cannot be set.
type
pydantic-field
type: Literal['local'] = 'local'
Discriminator for (de)serialization/CLI. Do not change.
check_valid_repo
check_valid_repo() -> Self
Source code in sweagent/environment/repo.py
75 76 77 78 79 80 81 82 83 84 |
|
copy
copy(deployment: AbstractDeployment)
Source code in sweagent/environment/repo.py
86 87 88 89 90 91 92 93 94 |
|
GithubRepoConfig
pydantic-model
Config:
extra
:'forbid'
Fields:
-
github_url
(str
) -
base_commit
(str
) -
clone_timeout
(float
) -
type
(Literal['github']
) -
repo_name
(str
)
base_commit
pydantic-field
base_commit: str = 'HEAD'
The commit to reset the repository to. The default is HEAD,
i.e., the latest commit. You can also set this to a branch name (e.g., dev
),
a tag (e.g., v0.1.0
), or a commit hash (e.g., a4464baca1f
).
SWE-agent will then start from this commit when trying to solve the problem.
clone_timeout
pydantic-field
clone_timeout: float = 500
Timeout for git clone operation.
github_url
pydantic-field
github_url: str
repo_name
pydantic-field
repo_name: str
type
pydantic-field
type: Literal['github'] = 'github'
Discriminator for (de)serialization/CLI. Do not change.
copy
copy(deployment: AbstractDeployment)
Clones the repository to the sandbox.
Source code in sweagent/environment/repo.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
|
repo_from_simplified_input
repo_from_simplified_input(*, input: str, base_commit: str = 'HEAD', type: Literal['local', 'github', 'preexisting', 'auto'] = 'auto') -> RepoConfig
Get repo config from a simplified input.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input
|
str
|
Local path or GitHub URL |
required |
type
|
Literal['local', 'github', 'preexisting', 'auto']
|
The type of repo. Set to "auto" to automatically detect the type (does not work for preexisting repos). |
'auto'
|
Source code in sweagent/environment/repo.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
|