-
Notifications
You must be signed in to change notification settings - Fork 45.9k
feat(platform): Add Block Development SDK with auto-registration system #10074
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…gistration - Add backend.sdk module with complete re-exports via 'from backend.sdk import *' - Implement auto-registration system for costs, credentials, OAuth, and webhooks - Add decorators (@Provider, @cost_config, @default_credentials, etc.) for self-contained blocks - Patch application startup to use auto-registration system - Create example blocks demonstrating new SDK patterns - Add comprehensive test suite for SDK functionality Key benefits: - Single import statement provides all block development dependencies - Zero external configuration - blocks are fully self-contained - Backward compatible - existing blocks continue to work unchanged - Minimal implementation - only 3 files, ~500 lines total 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2 tasks
…tatus - Mark completed items with ✅ (12/17 tasks completed) - Core SDK implementation: 100% complete - Auto-registration patches: 100% complete (with note on enum extension) - Testing and migration: 60% complete (3/5 tasks) - Note items left for future PRs (existing block migration, performance testing) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Analyze current ProviderName enum usage and limitations - Propose provider registry pattern as alternative solution - Maintain backward compatibility while enabling dynamic registration - Include 7-phase implementation checklist with ~30 tasks - Address the concern from PR #10074 about enum extension The plan enables true zero-configuration for new providers while maintaining type safety and validation through a custom Pydantic type. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add _missing_ method to ProviderName enum (15 lines) - Allows any string to be used as a provider name - Enables SDK @Provider decorator to work with custom providers - Maintains full backward compatibility and type safety - Much simpler than complex registry pattern (10 lines vs 200+) This completes the SDK implementation by solving the last remaining issue of dynamic provider registration. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add test_sdk_comprehensive.py with 8 test cases covering all SDK features - Add demo_sdk_block.py showing real-world usage with custom provider - Add test_sdk_integration.py for integration testing scenarios - Fix missing oauth_config export in SDK __init__.py - Add SDK_IMPLEMENTATION_SUMMARY.md documenting complete implementation - Update REVISED_PLAN.md checklist to show 100% completion Test Results: - All 8 comprehensive tests pass - Demo block works with zero external configuration - Auto-registration verified for providers, costs, and credentials - Dynamic provider enum support confirmed - Import * functionality working correctly The SDK is now fully implemented, tested, and ready for production use. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add noqa comments for star imports in SDK example/test files - Configure Ruff to ignore F403/F405 in SDK files - Fix webhook manager method signatures to match base class - Change == to is for type comparisons in tests - Remove unused variables or add noqa comments - Create pyrightconfig.json to exclude SDK examples from type checking - Update BlockWebhookConfig to use resource_format instead of event_format - Fix all poetry run format errors All formatting tools (ruff, isort, black, pyright) now pass successfully. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Fixed patched_get_all_creds to return list instead of dict - Fixed webhook manager _deregister_webhook signature to match base class - Fixed PROVIDER_NAME to use ProviderName enum properly - Removed all SDK file exclusions from pyrightconfig.json - All pyright errors resolved with 0 errors, 0 warnings 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Update CredentialsMetaInput.allowed_providers() to return None for unrestricted providers - Fix pyright type errors by using ProviderName() constructor instead of string literals - Update webhook manager signatures in tests to match abstract base class - Add comprehensive test suites for custom provider functionality - Configure ruff to ignore star import warnings in SDK and test files - Ensure all formatting tools (ruff, black, isort, pyright) pass successfully This enables SDK users to define custom providers without modifying core enums while maintaining strict type safety throughout the codebase.
- Remove all per-file-ignores from pyproject.toml - Delete pyrightconfig.json as it's no longer needed - Replace all star imports with explicit imports in SDK examples and tests - Reorganize imports in sdk/__init__.py to fix E402 errors - Fix duplicate imports and ensure all files pass strict linting - Maintain full functionality while improving code quality All linting tools (ruff, black, isort, pyright) now pass without any special exceptions or configuration overrides.
ntindle
previously approved these changes
Jul 9, 2025
This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request. |
ntindle
previously approved these changes
Jul 9, 2025
Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly. |
ntindle
approved these changes
Jul 10, 2025
|
🧹 Auto-undeploying: PR closed with active deployment. Cleaning up development environment for PR #10074. |
🧹 Preview Environment Cleaned Up All resources for PR #10074 have been removed:
Cleanup completed successfully. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
platform/backend
AutoGPT Platform - Back end
platform/blocks
platform/frontend
AutoGPT Platform - Front end
Review effort 4/5
size/xl
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Block Development SDK - Simplifying Block Creation
Problem
Currently, creating a new block requires manual updates to 5+ files scattered across the codebase:
backend/data/block_cost_config.py
- Manually add block costsbackend/integrations/credentials_store.py
- Add default credentialsbackend/integrations/providers.py
- Register new providersbackend/integrations/oauth/__init__.py
- Register OAuth handlersbackend/integrations/webhooks/__init__.py
- Register webhook managersThis creates significant friction for developers, increases the chance of configuration errors, and makes the platform difficult to scale.
Solution
This PR introduces a Block Development SDK that provides:
from backend.sdk import *
Changes 🏗️
1. New SDK Module (
backend/sdk/
)__init__.py
: Unified exports of 68+ block development componentsregistry.py
: Central auto-registration system for all block configurationsbuilder.py
:ProviderBuilder
class for fluent provider configurationprovider.py
: Provider configuration managementcost_integration.py
: Automatic cost application system2. Provider Builder Pattern
3. Automatic Cost System
@cost
decorator for block-specific pricing4. Dynamic Provider Support
ProviderName
enum to accept any string via_missing_
method5. Application Integration
sync_all_provider_costs()
toinitialize_blocks()
for automatic cost registration6. Comprehensive Examples (
backend/blocks/examples/
)simple_example_block.py
- Basic block structureexample_sdk_block.py
- Provider with credentialscost_example_block.py
- Various cost patternsadvanced_provider_example.py
- Custom API clientsexample_webhook_sdk_block.py
- Webhook configuration7. Extensive Testing
Before vs After
Before SDK:
After SDK:
Checklist 📋
For code changes:
For configuration changes:
.env.example
is updated or already compatible with my changes (no changes needed)docker-compose.yml
is updated or already compatible with my changes (no changes needed)Impact