Platform Backend
Use this sub-skill for the Python FastAPI backend and shared platform libraries: REST/WebSocket routes, graph execution, scheduler/executor services, blocks, provider integrations, workspace/media handling, Prisma schema, model catalog, backend CLI tools, and Python tests.
Reference map
- Read backend architecture to locate services, API features, data access, authentication, execution, and storage.
- Read block development for
Block,ProviderBuilder, credential schemas, OAuth/webhooks, media files, and block documentation/test contracts. - Read API, CLI, and testing for commands, OpenAPI generation, Prisma/migrations, snapshots, model catalog changes, and focused validation.
- Read troubleshooting for dependency, service, auth, database, block, and generated-artifact failures.
- Run
python scripts/backend_smoke.py --repo <checkout>for read-only layout, import, and CLI-help checks. It does not start Docker or reset a database.
Development sequence
- Work from
autogpt_platform/backendand usepoetry runfor Python package commands. Keep shared-library changes underautogpt_platform/autogpt_libs. - Identify the owning feature and its nearby tests. Route changes through the public API layer, Pydantic models, data functions, and service boundary rather than reaching across unrelated features.
- For an API change, update the route/model, add or revise focused tests, then export or fetch OpenAPI before asking the frontend to regenerate hooks.
- For a block, define schemas and credentials, implement
async run, provide deterministic test input/output or mocks, and test with the block harness. - For database changes, review
schema.prismaand migrations, use the dedicated test database path, and never point a reset at a developer's live database.
Useful commands
cd autogpt_platform/backend
poetry install
poetry run app
poetry run rest
poetry run ws
poetry run pytest path/to/test.py::test_name -xvs
poetry run test
poetry run format
poetry run lint
poetry run prisma migrate deploy
poetry run prisma generate
poetry run gen-prisma-stub
poetry run export-api-schema --output openapi.json --pretty
poetry run cli --help
poetry run oauth-tool --help
High-risk boundaries
- REST and WebSocket startup connects to PostgreSQL and Redis; imports or
--helpare safer than starting services. - Blocks may require API keys, OAuth, external network calls, media storage, ClamAV, or provider-specific packages. Prefer mocks and the built-in block test contract for local validation.
- Catalog changes are catalog-as-code. Keep model slugs, provider/creator
references, costs, routing, visibility, and
LLMModelenum lines consistent; use the documented retirement CLI for stored graph migrations. - Route to platform-stack for Docker/service
orchestration and platform-frontend for UI
consumers. Read workspace/media guidance
before changing file persistence or
store_media_file()behavior.
