SuperAPI AI Directory

new-block

Coding & development

View repository

Updated 10-16 05:34

About this skill

New Block Creation

Read docs/platform/block-sdk-guide.md first for the full guide.

Steps

  1. Provider config (if external service): create _config.py with ProviderBuilder
  2. Block file in backend/blocks/ (from autogpt_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
  3. Files: use store_media_file() with "for_block_output" for outputs
  4. Test: poetry run pytest 'backend/blocks/test/test_block.py::test_available_blocks[MyBlock]' -xvs
  5. 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_output for block outputs