Task Bundle

Combine multiple operations into a single tool.

category: Tool Composition
arcade.dev/patterns

Context

Multi-step operations that are commonly done together.

Problem

Requiring multiple tool calls for common workflows increases errors and latency.

Solution

Bundle related operations:
- Identify common sequences: search → select → act
- Combine into one: dm_user(name, message)
- Handle intermediate errors: Graceful failure
- Return composite result: All steps' outcomes

Examples

Python
@tool
def dm_user(
    user_name: str,
    message: str
) -> DMResult:
    """Send a direct message to a user by name.
    
    This tool:
    1. Searches for the user
    2. Opens/finds a DM conversation
    3. Sends the message
    
    Use this instead of calling search_users + open_dm + send_message.
    """
    user = search_users(user_name)
    if not user:
        return DMResult(error="User not found", suggestions=fuzzy_matches(user_name))
    conv = get_or_create_dm(user.id)
    return send_message(conv.id, message)

Considerations

  • Name bundles after the task, not the steps
  • Handle partial failures gracefully
  • Still expose individual tools for edge cases

Related Patterns

More in Tool Composition