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]

Docs: Start to add API documentation (#460)

Kilian Lieret80eda3672612
diff --git a/docs/dev/code_structure.md b/docs/dev/code_structure.md
deleted file mode 100644
index b44dd535..00000000
--- a/docs/dev/code_structure.md
+++ /dev/null
@@ -1,8 +0,0 @@
-# Code structure
-
-* See the [`scripts/`](https://github.com/princeton-nlp/SWE-agent/tree/main/scripts/) folder for other useful scripts and details.
-* See the [`config/`](https://github.com/princeton-nlp/SWE-agent/tree/main/config/) folder for details about how you can define your own configuration!
-* See the [`sweagent/agent/`](https://github.com/princeton-nlp/SWE-agent/tree/main/sweagent/agent/) folder for details about the logic behind configuration based workflows.
-* See the [`sweagent/environment/`](https://github.com/princeton-nlp/SWE-agent/tree/main/sweagent/environment/) folder for details about the `SWEEnv` environment (interface + implementation).
-* See the [`trajectories/`](https://github.com/princeton-nlp/SWE-agent/tree/main/trajectories) folder for details about the output of `run.py`.
-* See the [`evaluation/`](https://github.com/princeton-nlp/SWE-agent/tree/main/evaluation/) folder for details about how evaluation works.
\ No newline at end of file
diff --git a/docs/dev/contribute.md b/docs/dev/contribute.md
index 6d74db67..33964fbf 100644
--- a/docs/dev/contribute.md
+++ b/docs/dev/contribute.md
@@ -81,4 +81,18 @@ mkdocs serve
and point your browser to port 8000 or click one of the links in the output.
-{% include-markdown "../_footer.md" %}
\ No newline at end of file
+{% include-markdown "../_footer.md" %}
+
+## Diving into the code
+
+<div class="grid cards" markdown>
+
+- :material-cog:{ .lg .middle } __Code structure and reference__
+
+ ---
+
+ Read the reference for more information on our code.
+
+ [:octicons-arrow-right-24: Read more](codespaces.md)
+
+</div>
\ No newline at end of file
diff --git a/docs/reference/agent.md b/docs/reference/agent.md
new file mode 100644
index 00000000..3d0a55c8
--- /dev/null
+++ b/docs/reference/agent.md
@@ -0,0 +1,5 @@
+# The agent class
+
+::: sweagent.agent.agents
+ options:
+ allow_inspection: false
\ No newline at end of file
diff --git a/docs/reference/env.md b/docs/reference/env.md
new file mode 100644
index 00000000..1fea0c83
--- /dev/null
+++ b/docs/reference/env.md
@@ -0,0 +1,5 @@
+# The environment class
+
+::: sweagent.environment.swe_env
+ options:
+ allow_inspection: false
\ No newline at end of file
diff --git a/docs/reference/env_utils.md b/docs/reference/env_utils.md
new file mode 100644
index 00000000..9b573941
--- /dev/null
+++ b/docs/reference/env_utils.md
@@ -0,0 +1,5 @@
+# Environment utils
+
+::: sweagent.environment.utils
+ options:
+ allow_inspection: false
\ No newline at end of file
diff --git a/docs/reference/index.md b/docs/reference/index.md
new file mode 100644
index 00000000..7a9329e3
--- /dev/null
+++ b/docs/reference/index.md
@@ -0,0 +1,23 @@
+# Code structure and reference
+
+!!! warning "This section is in development"
+ Some submodules are missing. We also do not strive for completeness, but provide this as an easy entry point
+ for people who want to start reading the code.
+ Also note that SWE-agent is still developed very actively, so the python implementation details
+ are still changing. See [the changelog](../installation/changelog.md) for more information.
+
+The core:
+
+* The `sweagent/agent/` []() submodule implements the agent.
+ * [Read about the `Agent` class](agent.md)
+ * [Explore the code](https://github.com/princeton-nlp/SWE-agent/tree/main/sweagent/agent/)
+* The [`sweagent/environment/`] submodule handles the communication with the docker container where we execute code.
+ * [Read about the `SWEEnv` class](agent.md)
+ * [Explore the code](https://github.com/princeton-nlp/SWE-agent/tree/main/sweagent/environment/)
+
+More subolders
+
+* See the [`scripts/`](https://github.com/princeton-nlp/SWE-agent/tree/main/scripts/) folder for other useful scripts and details.
+* See the [`config/`](https://github.com/princeton-nlp/SWE-agent/tree/main/config/) folder for details about how you can define your own configuration!
+* See the [`trajectories/`](https://github.com/princeton-nlp/SWE-agent/tree/main/trajectories) folder for details about the output of `run.py`.
+* See the [`evaluation/`](https://github.com/princeton-nlp/SWE-agent/tree/main/evaluation/) folder for details about how evaluation works.
diff --git a/docs/reference/models.md b/docs/reference/models.md
new file mode 100644
index 00000000..01a71f2b
--- /dev/null
+++ b/docs/reference/models.md
@@ -0,0 +1,5 @@
+# Models
+
+::: sweagent.agent.models
+ options:
+ allow_inspection: false
\ No newline at end of file
diff --git a/mkdocs.yml b/mkdocs.yml
index 0b29f2f9..86f2ea61 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -74,10 +74,21 @@ nav:
- "Contribution guide": "dev/contribute.md"
- "Formatting conflicts": "dev/formatting_conflicts.md"
- "Code structure": "dev/code_structure.md"
+ - Reference:
+ - "reference/index.md"
+ - "Agent": "reference/agent.md"
+ - "Models": "reference/models.md"
+ - "Environment": "reference/env.md"
+ - "Environment utils": "reference/env_utils.md"
plugins:
- glightbox
- search
- include-markdown
+ - mkdocstrings:
+ default_handler: python
+ handlers:
+ python:
+ paths: [sweagent]
repo_url: https://github.com/princeton-nlp/SWE-agent
repo_name: princeton-nlp/SWE-agent
edit_uri: edit/main/docs/
\ No newline at end of file
diff --git a/pyproject.toml b/pyproject.toml
index 3d641860..759b326f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -41,6 +41,7 @@ dev = [
"mkdocs-material",
"mkdocs-glightbox",
"mkdocs-include-markdown-plugin",
+ "mkdocstrings[python]>=0.18",
"pytest",
"pytest-cov",
"pipx",