Skip to content

Latest commit

 

History

History
214 lines (165 loc) · 7.66 KB

DEVELOPER_GUIDE.md

File metadata and controls

214 lines (165 loc) · 7.66 KB

Developer Guide

This guide provides essential information for developers working on the Open Agent Kernel project.

Table of Contents

Prerequisites

Before you begin development, ensure you have the following installed:

  • Python 3.12 or higher
  • uv - Fast Python package installer and resolver
  • Git
  • Make

Setup Your Development Environment

  1. Fork the repository on GitHub

  2. Clone your fork locally:

    git clone https://github.com/<your-username>/agent-kernel.git
    cd agent-kernel
  3. Add the upstream repository:

    git remote add upstream https://github.com/yaalalabs/agent-kernel.git
  4. Create a branch for your changes:

    git checkout -b feature/your-feature-name

Development

  1. Run the dev setup script from the repo root to install prerequisites (pyenv, Python 3.12, uv) and sync the ak-py virtual environment:

    make dev-setup

    or directly:

    ./scripts/dev-setup.sh

    Alternatively, set things up manually:

    cd ak-py
    ./build.sh

Makefile Commands

The project includes a Makefile with several useful commands for code formatting and quality checks. All commands should be run from the root directory of the project.

Available Commands

To see all available Makefile commands:

make help

Code Quality

Formatting Standards

OAK uses the following tools to maintain code quality:

  • black: Opinionated code formatter
  • isort: Import statement organizer
  • ruff: Enforces modern type annotations only (list[str], X | None, collections.abc imports) via its pyupgrade rules UP006, UP007, UP035 and UP045

Pre-commit Workflow

Before committing code, run:

make lint-check-all

This ensures your code meets the project's formatting standards without making changes. If issues are found, run:

make lint-all

to automatically fix formatting issues.

Lint and Commit Workflow (CI)

For applying formatting on a remote branch without running the tools locally, use the Lint and Commit GitHub Actions workflow (.github/workflows/lint-fix.yml). Trigger it manually from the Actions tab (workflow_dispatch) with two inputs:

  • lint_target: which Makefile target to run — lint, lint-examples, or lint-all (default).
  • branch: the branch to format and commit the changes to.

The workflow runs the selected target and pushes a chore: commit with any formatting changes back to the chosen branch. Protected branches (currently develop) are rejected — the workflow fails before making any changes.

Pull Request Automation (CI)

Four small workflows run on pull requests:

  • PR Title Check (.github/workflows/pr-title-check.yaml): fails unless the PR title follows Conventional Commits (type: description or type(scope): description, with the types listed in CONTRIBUTING.md). develop accepts squash merges only, so the title becomes the commit subject. Fix a failure by editing the title; the check re-runs on the edit.
  • Changelog Check (.github/workflows/changelog-check.yaml): on PRs into develop, fails a feat, fix, perf, refactor, build or chore PR that neither adds a changelog.d/ fragment nor updates a pending one, a ! title without a breaking fragment, and any fragment with an invalid name; the rules are in CONTRIBUTING.md, "Changelog entries" and the logic in scripts/changelog_fragments.py. A maintainer skips it with the no-changelog label. The job summary previews the next release's changelog. It uses pull_request, not pull_request_target: it runs the PR's own copy of the script, which is safe only because the token is read-only and no secrets are passed. Keep it that way when editing it.
  • Request Copilot Review (.github/workflows/copilot-review-request.yaml): requests a GitHub Copilot code review when a maintainer adds the Request Copilot label to a PR, using the COPILOT_REVIEW_PAT secret. The develop ruleset's own Copilot rule only fires for authors who hold a license, which is why this workflow exists. Nothing is requested automatically: each review is a premium request billed to the PAT owner's license, so it is spent only when someone with triage access or higher (the only people who can apply labels) decides a PR is worth it. Read the PR first, then add the label; this works the same for collaborator, bot-authored, and outside contributor PRs. To request another review after new commits, remove the label and add it again. The label must exist in the repository (gh label create "Request Copilot"). COPILOT_REVIEW_PAT is a fine-grained PAT created by a licensed maintainer with resource owner yaalalabs, access to this repository, and "Pull requests: Read and write". It is separate from COPILOT_REQUEST_TOKEN (used by the docs-sync workflow) because GitHub only allows the account-level Copilot Requests permission on user-owned tokens, and a user-owned token cannot hold repository permissions on an organization repo.
  • Reset Reviewed Label (.github/workflows/reviewed-label-reset.yaml): maintainers add the Reviewed label after going through a PR; any new push removes it again so the PR reappears in the review queue (is:pr is:open -label:Reviewed).

The last two use pull_request_target so they also work for fork PRs. Neither checks out PR code; they only call the GitHub API. Keep it that way when editing them.

Contributing

Development Workflow

  1. Create a feature branch

    git checkout -b feature/your-feature-name
  2. Make your changes

    • Write code following the project's conventions
    • Add tests for new functionality
    • Add a changelog fragment (changelog.d/<issue>.<type>.md) if users would notice the change; see CONTRIBUTING.md, "Changelog entries"
  3. Verify formatting

    make lint-check-all
  4. Format your code

    make lint-all
  5. Run tests

    cd ak-py
    uv run pytest
  6. Commit your changes

    git add .
    git commit -m "feat: describe your changes"
  7. Push to your branch

    git push origin feature/your-feature-name

Commit Message Convention

Follow conventional commit format:

  • feat: - New feature
  • fix: - Bug fix
  • docs: - Documentation changes
  • chore: - Maintenance tasks
  • refactor: - Code refactoring
  • test: - Test additions or modifications

Code Review

  • Ensure all formatting checks pass
  • Add appropriate tests
  • Ensure all CI tests pass
  • Update documentation if needed
  • Request review from maintainers

Additional Resources

  • Main README - Project overview and usage
  • AGENTS.md - Guidance for AI coding agents contributing to this repo (architecture pointers, agent-specific gotchas)
  • Documentation Setup - Setting up the documentation site
  • Examples - Sample implementations
  • Use Cases - End-to-end agents built from SPEC.md using OAK skills
  • e2e - Messaging integration e2e harness (deployable app + Terraform + pytest suite) driven against real Slack, Telegram, WhatsApp, Messenger, Instagram, and Gmail accounts