scaffold¶
Description¶
Commands for scaffolding new components.
Available Commands:
contract: Scaffold a smart contract component
fsm: Scaffold a Finite State Machine (FSM)
protocol: Scaffold a protocol component
connection: Scaffold a connection component
handler: Generate an AEA handler from OpenAPI 3 specification
Subcommands¶
behaviour¶
Generate AEA behaviours from an OpenAPI 3 specification.
Required Parameters:
spec_file: Path to OpenAPI 3 specification file
- Must be a valid OpenAPI 3.0+ specification
- File must exist and be readable
Optional Parameters:
target_speech_acts (--target-speech-acts): Comma separated list of speech acts to scaffold. (Default: None)
- If provided, only generates behaviours for specified speech acts
- Must match speech acts defined in the spec
auto_confirm (--auto-confirm): Skip confirmation prompts. (Default: False)
- Automatically applies all changes without prompting
- Use with caution in production environments
behaviour_type (--behaviour-type): Type of behaviour to generate. (Default: metrics)
- metrics: Generates metrics collection behaviour
- simple_fsm: Generates simple finite state machine behaviour
Usage:
Generate metrics behaviour:
adev scaffold behaviour openapi.yaml --behaviour-type metrics
Generate FSM behaviour:
adev scaffold behaviour openapi.yaml --behaviour-type simple_fsm
Generate specific speech acts:
adev scaffold behaviour openapi.yaml --target-speech-acts "request,inform"
Skip confirmations:
adev scaffold behaviour openapi.yaml --auto-confirm
Notes¶
Generation Process:
- Parses OpenAPI specification
- Creates behaviour class structure
- Implements required methods
- Adds necessary imports
Features:
- Multiple behaviour type support
- Speech act filtering
- Auto-confirmation option
- OpenAPI 3.0+ compatibility
Integration:
- Works with existing AEA projects
- Compatible with custom skills
- Supports behaviour composition
- Handles complex specifications
Error Handling:
- Validates OpenAPI specification
- Checks speech act existence
- Reports generation failures
- Preserves existing code
Returns¶
None
connection¶
Scaffold a new connection component.
Required Parameters:
name: Name of the connection to create.
protocol: Public ID of the protocol to use (author/name format).
Usage:
Create connection with protocol:
adev scaffold connection my_connection --protocol author/protocol_name
Create connection in specific directory:
cd my_project
adev scaffold connection my_connection --protocol author/protocol_name
contract¶
Scaffold a smart contract component.
Required Parameters:
one of:
public_id: The public ID of the contract (author/name format).
from_file: Path to file containing contract addresses and names.
Optional Parameters:
address(--address): Contract address on the blockchain. (Default: null address)
from_abi(--from-abi): Path to ABI file to use for scaffolding. (Default: None)
network(--network): Blockchain network to fetch ABI from. (Default: ethereum)
read_functions(--read-functions): Comma-separated list of read functions to include. (Default: None (all))
write_functions(--write-functions): Comma-separated list of write functions to include. (Default: None (all))
Usage: Scaffold from address: adev scaffold contract author/contract_name --address 0x123...
Scaffold from ABI file:
adev scaffold contract author/contract_name --from-abi ./contract.abi
Scaffold from file with multiple contracts:
adev scaffold contract --from-file ./contracts.yaml
Scaffold with specific network:
adev scaffold contract author/contract_name --address 0x123... --network polygon
Scaffold with specific functions:
adev scaffold contract author/contract_name --address 0x123... --read-functions "balanceOf,totalSupply"
dao¶
Scaffold Data Access Objects (DAOs) and generate test scripts based on an OpenAPI 3 specification.
This command creates:
- Data Access Object classes for each model in the OpenAPI spec
- Sample data for testing
- Test scripts to validate the Data Access Objects
dialogues¶
Generate AEA dialogues from an OpenAPI 3 specification.
Required Parameters:
spec_file: Path to OpenAPI 3 specification file
- Must be a valid OpenAPI 3.0+ specification
- File must exist and be readable
Optional Parameters:
target_speech_acts (--target-speech-acts): Comma separated list of speech acts to scaffold. (Default: None)
- If provided, only generates dialogues for specified speech acts
- Must match speech acts defined in the spec
auto_confirm (--auto-confirm): Skip confirmation prompts. (Default: False)
- Automatically applies all changes without prompting
- Use with caution in production environments
dialogue_type (--dialogue-type): Type of dialogue to generate. (Default: simple)
- simple: Generates basic request/response dialogue
Usage: Generate simple dialogue: adev scaffold dialogues openapi.yaml --dialogue-type simple
Generate specific speech acts:
adev scaffold dialogues openapi.yaml --target-speech-acts "request,inform"
Skip confirmations:
adev scaffold dialogues openapi.yaml --auto-confirm
Notes¶
Generation Process:
- Parses OpenAPI specification
- Creates dialogue class structure
- Implements dialogue rules
- Adds necessary imports
Features:
- Multiple dialogue type support
- Speech act filtering
- Auto-confirmation option
- OpenAPI 3.0+ compatibility
Integration:
- Works with existing AEA projects
- Compatible with custom skills
- Supports dialogue composition
- Handles complex specifications
Error Handling:
- Validates OpenAPI specification
- Checks speech act existence
- Reports generation failures
- Preserves existing code
Returns¶
None
fsm¶
Scaffold a new Finite State Machine (FSM).
Optional Parameters:
spec: Path to FSM specification YAML file. Default: None
Usage:
Scaffold base FSM:
adev scaffold fsm
Scaffold from specification:
adev scaffold fsm --spec fsm_specification.yaml
Notes¶
- Requires aea_config.yaml in current directory
- Automatically adds required base FSM skills:
- abstract_abci
- abstract_round_abci
- registration_abci
- reset_pause_abci
- termination_abci
- When using spec file:
- Must be valid FSM specification in YAML format
- FSM label must end with 'App' suffix
- Creates FSM based on specification structure
handler¶
Generate an AEA handler from an OpenAPI 3 specification.
Required Parameters: spec_file: Path to OpenAPI 3 specification file
public_id: Public ID for the handler (author/name format)
Optional Parameters:
new_skill: Create a new skill for the handler. Default: False
auto_confirm: Skip confirmation prompts. Default: False
Usage:
Basic handler generation:
adev scaffold handler api_spec.yaml author/handler_name
Create new skill:
adev scaffold handler api_spec.yaml author/handler_name --new-skill
Skip confirmations:
adev scaffold handler api_spec.yaml author/handler_name --auto-confirm
Notes¶
- Requires aea_config.yaml in current directory
- Generates handler code from OpenAPI endpoints
- Creates necessary message classes
- Can optionally create a new skill
- Shows changes and prompts for confirmation
handlers¶
Generate AEA handlers from an OpenAPI 3 specification.
Required Parameters:
spec_file: Path to OpenAPI 3 specification file
- Must be a valid OpenAPI 3.0+ specification
- File must exist and be readable
Optional Parameters:
target_speech_acts (--target-speech-acts): Comma separated list of speech acts to scaffold. (Default: None)
- If provided, only generates handlers for specified speech acts
- Must match speech acts defined in the spec
auto_confirm (--auto-confirm): Skip confirmation prompts. (Default: False)
- Automatically applies all changes without prompting
- Use with caution in production environments
handler_type (--handler_type): Type of handler to generate. (Default: simple)
- simple: Generates basic request/response handler
Usage:
Generate simple handler:
adev scaffold handlers openapi.yaml --handler_type simple
Generate specific speech acts:
adev scaffold handlers openapi.yaml --target-speech-acts "request,inform"
Skip confirmations:
adev scaffold handlers openapi.yaml --auto-confirm
Notes¶
Generation Process:
- Parses OpenAPI specification
- Creates handler class structure
- Implements handle methods
- Adds necessary imports
Features:
- Multiple handler type support
- Speech act filtering
- Auto-confirmation option
- OpenAPI 3.0+ compatibility
Integration:
- Works with existing AEA projects
- Compatible with custom skills
- Supports handler composition
- Handles complex specifications
Error Handling:
- Validates OpenAPI specification
- Checks speech act existence
- Reports generation failures
- Preserves existing code
Returns¶
None
protocol¶
Scaffold a new protocol component.
Required Parameters:
protocol_specification_path: Path to protocol specification file
Optional Parameters:
language: Programming language for protocol (default: python)
Usage:
Basic protocol scaffolding:
adev scaffold protocol path/to/spec.yaml
Specify language:
adev scaffold protocol path/to/spec.yaml --l python
Notes¶
- Creates protocol package from specification
- Supports multiple programming languages
- Generates message classes and serialization
- Adds protocol to agent configuration
tests¶
Generate tests for an aea component in the current directory AEA handler from an OpenAPI 3 specification.