New Block Creation
Read docs/platform/block-sdk-guide.md first for the full guide.
Steps
- Provider config (if external service): create
_config.pywithProviderBuilder - Block file in
backend/blocks/(fromautogpt_platform/backend/):
- Generate a UUID once with uuid.uuid4(), then hard-code that string as id (IDs must be stable across imports) - Input(BlockSchema) and Output(BlockSchema) classes - async def run that yields output fields
- Files: use
store_media_file()with"for_block_output"for outputs - Test:
poetry run pytest 'backend/blocks/test/test_block.py::test_available_blocks[MyBlock]' -xvs - Format:
poetry run format
Rules
- Analyze interfaces: do inputs/outputs connect well with other blocks in a graph?
- Use top-level imports, avoid duck typing
- Always use
for_block_outputfor block outputs