Operation Mode

Provide different modes for different access patterns.

category: Tool Composition
arcade.dev/patterns

Context

Tools that serve both exploration and execution needs.

Problem

The same capability needs different behaviors for different contexts.

Solution

Support multiple modes:
- Explore mode: Read-only, safe to experiment
- Execute mode: Actually perform actions
- Preview mode: Show what would happen
- Dry-run mode: Validate without executing,
- Get schema mode: Useful when the upstream API has a complex schema not suitable to be represented in the tool interface

Examples

Python
class Mode(Enum):
    EXPLORE = "explore"  # List what's possible
    PREVIEW = "preview"  # Show what would happen
    EXECUTE = "execute"  # Actually do it

@tool
def manage_files(
    action: str,
    files: list[str],
    mode: Mode = Mode.PREVIEW
) -> ActionResult:
    """Manage files with preview capability.
    
    Modes:
    - explore: List available actions
    - preview: Show what would change (default)
    - execute: Actually perform the action
    """

Considerations

  • Default to the safest mode (preview/explore)
  • Make mode explicit in the description
  • When possible, return the same structure regardless of mode

Related Patterns

More in Tool Composition