|
1 | | -# Documentation System Overview |
| 1 | +# OpenHands SDK Documentation Guidelines |
2 | 2 |
|
3 | | -The documentation for this project follows a synchronized approach where code examples in the docs are automatically kept in sync with the actual example files in the agent-sdk repository. |
| 3 | +These instructions are ONLY for modifying the documentation associated with the agent SDK which mainly lives under the |
| 4 | +sdk folder. |
4 | 5 |
|
| 6 | +## Repository Structure |
| 7 | + |
| 8 | +Applicable files when modifying the agent SDK documentation: |
| 9 | + |
| 10 | +``` |
| 11 | +docs/ |
| 12 | +├── .openhands/microagents/sdk-guidelines.md # Guidelines for changing SDK documentation (this file) |
| 13 | +├── .github/ |
| 14 | +│ ├── scripts/ |
| 15 | +│ │ └── sync_code_blocks.py # Code synchronization script |
| 16 | +│ └── workflows/ # CI/CD workflows |
| 17 | +├── sdk/ # Agent SDK documentation |
| 18 | +│ ├── guides/ # SDK tutorials and guides |
| 19 | +│ └── arch/ # Architecture documentation |
| 20 | +└── docs.json # Mintlify navigation configuration |
| 21 | +``` |
| 22 | + |
| 23 | +## Agent SDK Documentation System Overview |
| 24 | + |
| 25 | +The documentation follows a synchronized approach where code examples are automatically kept in sync with actual |
| 26 | +example files in the agent-sdk repository. |
5 | 27 |
|
6 | 28 | ## Automatic Code Synchronization |
7 | 29 |
|
@@ -43,11 +65,12 @@ pattern = r'```python[^\n]*\s+(examples/[^\s]+\.py)\n(.*?)```' |
43 | 65 | - Captures file path: `examples/01_standalone_sdk/02_custom_tools.py` |
44 | 66 | - Captures code content between opening and closing ``` |
45 | 67 |
|
46 | | - |
47 | 68 | ## MDX Documentation Format |
48 | 69 |
|
49 | 70 | ### Standard Structure |
50 | | -Documentation is deployed with Mintlify from GitHub. The files follow this pattern (see `docs/sdk/guides/custom-tools.mdx` and `docs/sdk/guides/mcp.mdx` as reference): |
| 71 | + |
| 72 | +Documentation is deployed with Mintlify from GitHub. The files follow this pattern |
| 73 | +(see `docs/sdk/guides/custom-tools.mdx` and `docs/sdk/guides/mcp.mdx` as reference): |
51 | 74 |
|
52 | 75 | 1. **Frontmatter** - YAML metadata with title and description |
53 | 76 | 2. **Introduction** - Brief overview of the feature |
@@ -170,7 +193,6 @@ This example is available on GitHub: [examples/01_standalone_sdk/02_custom_tools |
170 | 193 | 4. **Consistency**: Follow existing patterns |
171 | 194 | - Use same icon/expandable syntax |
172 | 195 | - Include "Running the Example" bash block |
173 | | - - Add <Note> component with GitHub link |
174 | 196 | - Structure sections similarly to other guides |
175 | 197 |
|
176 | 198 | 5. **Testing**: Before committing documentation |
@@ -213,6 +235,24 @@ name: Example Workflow |
213 | 235 | on: [push] |
214 | 236 | ``` |
215 | 237 |
|
216 | | -## Mintlify documentation |
| 238 | +## Mintlify Documentation |
| 239 | +
|
| 240 | +You can check https://www.mintlify.com/docs for documentation on what our doc site supports. |
| 241 | +
|
| 242 | +## CI/CD Workflows |
| 243 | +
|
| 244 | +### Code Synchronization Workflow |
| 245 | +- **File**: `.github/workflows/sync-docs-code-blocks.yml` |
| 246 | +- **Triggers**: Push to any branch, daily at 2 AM UTC, manual dispatch |
| 247 | +- **Purpose**: Keeps code blocks in sync with agent-sdk examples |
| 248 | +- **Actions**: Checks out both repositories, runs sync script, commits changes if needed |
| 249 | + |
| 250 | +### OpenAPI Sync Workflow |
| 251 | +- **File**: `.github/workflows/sync-agent-sdk-openapi.yml` |
| 252 | +- **Purpose**: Syncs OpenAPI specifications for API documentation |
| 253 | + |
| 254 | +## Notes |
217 | 255 |
|
218 | | -You can check https://www.mintlify.com/docs for documentation on what our doc site supported. |
| 256 | +- For agent-sdk examples, ensure the file path in code blocks is correct |
| 257 | +- For short agent-sdk examples, you don't need `expandable` in example file |
| 258 | +- When you add new pages that need to refer to agent-sdk example script, you should create an empty block with correct block name (refer to the python example script correctly), then run `python .github/scripts/sync_code_blocks.py` to sync it |
0 commit comments