AutoGPT Advanced Usage Guide
Agentby davila7 · Added 5mo ago
Claude
Install
npx claude-code-templates@latest --agent=cli-tool/components/skills/ai-research/agents-autogpt/references --yesAdd to Claude
claude mcp add autogpt-advanced-usage-guideAbout
AutoGPT Advanced Usage Guide
Custom Block Development
Block structure
from backend.data.block import Block, BlockSchema, BlockType
from pydantic import BaseModel
class MyBlockInput(BaseModel):
"""Input schema for the block."""
query: str
max_results: int = 10
class MyBlockOutput(BaseModel):
"""Output schema for the block."""
results: list[str]
count: int
class MyCustomBlock(Block):
"""Custom block for specific functionality."""
id = "my-custom-block-uuid"
name = "My Custom Block"
description = "Does something specific"
block_type = BlockType.STANDARD
input_schema = MyBlockInput
output_schema = MyBlockOutput
async def execute(self, input_data: MyBlockInput) -> dict:
"""Execute the block logic."""
# Implement your logic
results = await self.process(input_data.query, input_data.max_results)
yield "results", results
yield "count", len(results)
async def process(self, query: str, max_results: int) -> list[str]:
"""Internal processing logic."""
# Implementation
return ["result1", "result2"]
Block registration
# backend/blocks/__init__.py
from backend.blocks.my_block import MyCustomBlock
# Add to block registry
BLOCKS = [
MyCustomBlock,
# ... other blocks
]
Block with credentials
from backend.data.block import Block
from backend.integrations.providers import ProviderName
class APIIntegrationBlock(Block):
"""Block that uses external API credentials."""
credentials_required = [ProviderName.OPENAI]
async def execute(self, input_data):
# Get credentials from the system
credentials = await self.get_credentials(ProviderName.OPENAI)
# Use credentials
client = OpenAI(api_key=credentials.api_key)
response = await client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": input
Tags
FullStackaitmplclaude-code-templates