Skip to content

Add auto-generated Python API reference documentation from software-agent-sdk #65

@xingyaoww

Description

@xingyaoww

Background

The OpenHands SDK provides a Python API for building AI agents, but currently lacks comprehensive API reference documentation on the docs site. Having clear, auto-generated Python API documentation is standard practice and would:

  • Make it easier for users to discover available classes, methods, and parameters
  • Encourage us to keep code comments and docstrings up to date
  • Provide a single source of truth for the Python API

Current State

We currently have two automated workflows that sync content from the OpenHands/software-agent-sdk repository:

  1. Code Block Sync (.github/workflows/sync-docs-code-blocks.yml) - Syncs example code snippets from the SDK repo into documentation pages
  2. OpenAPI Sync (.github/workflows/sync-agent-sdk-openapi.yml) - Generates and syncs OpenAPI specifications from the SDK's agent server

These workflows demonstrate the pattern for automatically pulling content from the SDK repository and updating the docs.

Proposed Solution

Create a new GitHub Actions workflow similar to the existing sync workflows that:

  1. Checks out the OpenHands/software-agent-sdk repository
  2. Generates Python API documentation using a tool like:
  3. Converts the output to Mintlify-compatible format (MDX)
  4. Commits and pushes the generated documentation to the docs repository
  5. Runs on a schedule (e.g., daily) and on-demand via workflow_dispatch

Implementation Considerations

  • Scope: Decide which modules/classes to include (e.g., public API only)
  • Format: Ensure output is compatible with Mintlify's MDX format
  • Navigation: Update docs.json to include the new API reference section
  • Styling: Consider include/exclude patterns for classes/methods to avoid noise
  • Location: Suggest placing generated docs under sdk/api/ or similar

Example Workflow Structure

Similar to sync-agent-sdk-openapi.yml:

name: Sync SDK API Reference

on:
  schedule:
    - cron: '0 2 * * *'
  workflow_dispatch:
    inputs:
      agent_sdk_ref:
        description: 'Agent SDK branch/tag/commit to generate from'
        required: false
        default: 'main'

jobs:
  sync-api-docs:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout docs repo
      - name: Checkout agent-sdk
      - name: Generate API documentation
      - name: Convert to MDX format
      - name: Update docs.json navigation
      - name: Commit and push

Benefits

✅ Standard documentation practice for Python libraries
✅ Easier API discovery for users
✅ Automated - stays in sync with SDK changes
✅ Encourages better docstrings in the codebase
✅ Follows existing patterns in our docs infrastructure

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions