This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
All instructions for Claude Code must live in this file (committed to the repo), not in external memory or user-level config.
- Always use
uvto invoke Python for dev tooling (scripts, generators, one-off commands). Never use barepythonorpython3. Example:uv run --python 3.12 --with pyyaml script.py.
Monorepo for the Sema4.ai Actions framework. Provides a system for extending AI agents with custom actions and MCP (Model Context Protocol) tools using Python. The Action Server hosts Python @action/@tool functions as REST APIs and MCP endpoints.
- action_server/ — Core Action Server: discovers/loads action packages, serves REST API + MCP endpoint + web UI
- actions/ —
sema4ai-actionslibrary:@action,@querydecorators and core action runtime - mcp/ —
sema4ai-mcplibrary:@tool,@resource,@promptMCP protocol decorators - common/ —
sema4ai-commonlibrary: shared utilities - sema4ai-http-helper/ — HTTP library for enterprise networks (MITM proxy support)
- build_common/ — Shared build utilities for creating signed executables
- devutils/ — Development utilities, invoke task builder, test fixtures, linting config
- templates/ — Action package templates for bootstrapping new projects
Dependency flow: action_server → actions, mcp, common, http-helper. mcp → actions. Each module is independently versioned and released.
Prerequisites: Install uv, then uv run --python 3.12 pip install -r devutils/requirements.txt (installs Poetry + Invoke).
All module-level commands are run from within the module directory (e.g., cd action_server):
| Command | Description |
|---|---|
inv install |
Install project dependencies (creates .venv or uses active env) |
inv test |
Run all pytest tests |
inv test -t path/to/test.py::test_func |
Run a specific test |
inv lint |
Run ruff + isort + pylint |
inv pretty |
Auto-format code (ruff format + isort) |
inv typecheck |
Run mypy |
inv docs |
Generate API documentation |
inv check-all |
Run all checks (lint, typecheck, docs, tests) |
inv set-version <version> |
Bump version across relevant files |
inv make-release |
Create and push release git tag |
Root-level tasks (from repo root):
inv install— Install all modules' dependencies sequentiallyinv docs— Generate docs for all modulesinv unreleased— Compare local versions to PyPI
- Framework: pytest. Tests live in
tests/within each module. - Run all:
inv testfrom the module directory. - Run one:
inv test -t tests/test_file.py::test_name - Tests run in parallel by default unless configured otherwise.
- Formatter/Linter: Ruff (line-length 88), isort (Black profile), pylint
- Type checking: mypy
- Convention: Private modules prefixed with underscore (
_private_module.py). Public API exported from__init__.py. - Source layout:
<module>/src/sema4ai/<package_name>/for source,<module>/tests/for tests.
GitHub Actions workflows in .github/workflows/ are auto-generated by _gen_workflows.py. Do not edit .yml workflow files directly — edit the generator script and re-run it.
inv set-version <version>to bump versioninv check-allto validate- Commit to
master inv make-releaseto tag and push (triggers CI release workflow)
- Action Server CLI entry point:
action_server/src/sema4ai/action_server/cli.py(only public API of the module) - Actions run in isolated Python subprocesses via a process pool
@action(fromsema4ai.actions) and@tool(fromsema4ai.mcp) are interchangeable — both are discovered by Action Server- Action metadata (type hints + docstrings) drives the generated OpenAPI spec and AI agent understanding
package.yamldefines the reproducible Python environment for action packages (managed by RCC)- Frontend is Vue.js + Vite in
action_server/frontend/; built output is committed as_static_contents.py - The
_static_contents.pyand_oauth2_config.pyfiles in action_server are excluded from ruff formatting