Purpose: FastAPI-based REST interface for programmatic pipeline invocation, job management, and tool discovery. Pipeline Step: Infrastructure module (not a numbered step) Category: Infrastructure / API Status: ✅ Production Ready Version: 1.0.0 Last Updated: 2026-03-24
The api module provides a FastAPI-based REST interface for the GNN processing pipeline.
It enables programmatic pipeline invocation, job management, and tool discovery without
requiring direct CLI access.
src/api/
__init__.py -- Module metadata, availability checks
models.py -- Pydantic request/response models (API contract)
processor.py -- In-memory job manager, async execution
server.py -- FastAPI app with routes and middleware
mcp.py -- MCP tool registration manifest
AGENTS.md -- This file
| Method | Path | Description |
|---|---|---|
| POST | /api/v1/process | Submit pipeline job |
| GET | /api/v1/jobs/{id} | Poll job status |
| DELETE | /api/v1/jobs/{id} | Cancel job |
| GET | /api/v1/jobs | List recent jobs |
| GET | /api/v1/tools | List pipeline steps |
| POST | /api/v1/tools/{step} | Invoke single step |
| GET | /api/v1/health | Health check |
The API module requires optional dependencies:
uv sync --extra api
# then:
python -m api.server
# or:
uvicorn api.server:app --reload- No authentication: Research tool for local use only. Document explicitly.
- In-memory jobs: No database required. Jobs lost on restart.
- AsyncIO execution: Non-blocking pipeline runs via asyncio subprocess.
- Background tasks: FastAPI BackgroundTasks for fire-and-forget job execution.
- CORS: Allows localhost origins for browser-based access.
This module is NOT a numbered pipeline step. It is an optional service module that wraps the pipeline for API access. Import it independently:
from api.processor import create_job, execute_job_asyncWhen working with this module:
- The
processor.pycontains job lifecycle logic -- extend it for persistence needs - The
models.pyis the API contract -- change carefully to preserve backwards compatibility - Add new endpoints in
server.pyfollowing the existing pattern - MCP tools in
mcp.pyshould mirror significant REST endpoints