Files
AutoGPT/docs
Reinier van der Leer 4ca1a453c9 refactor(backend): Defer loading of .blocks and .integrations.webhooks on module init (#9664)
Currently, an import statement like `from backend.blocks.basic import
AgentInputBlock` will initialize `backend.blocks` and thereby load all
other blocks. This has quite high potential to cause circular import
issues, and it's bad for performance in cases where we don't want to
load all blocks (yet).
The same goes for `backend.integrations.webhooks`.

### Changes 🏗️

- Change `__init__.py` of `backend.blocks` and
`backend.integrations.webhooks` to cached loader functions rather than
init-time code
- Change type of `BlockWebhookConfig.provider` to `ProviderName`

<!-- test edit to check that this doesn't break anything -->

### Checklist 📋

#### For code changes:
- [x] I have clearly listed my changes in the PR description
- [x] I have made a test plan
- [x] I have tested my changes according to the test plan:
  - [x] Set up and use an agent with a webhook-triggered block

---------

Co-authored-by: Zamil Majdy <zamil.majdy@agpt.co>
2025-03-24 15:44:45 +00:00
..