> ## Documentation Index
> Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Assign Tools to Templates

> Step-by-step guide to assigning and configuring tools in templates

## How to Assign Built-in Tools

<Steps>
  <Step title="List Available Built-in Tools">
    ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    praisonai tools list
    ```
  </Step>

  <Step title="Add to TEMPLATE.yaml">
    ```yaml theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    # TEMPLATE.yaml
    name: my-template
    version: "1.0.0"

    requires:
      tools:
        - internet_search
        - shell_tool
        - file_read_tool
    ```
  </Step>

  <Step title="Assign to Agents">
    ```yaml theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    # agents.yaml
    roles:
      researcher:
        role: Research Agent
        tools:
          - internet_search
      executor:
        role: Executor Agent
        tools:
          - shell_tool
          - file_read_tool
    ```
  </Step>
</Steps>

## How to Assign Custom Tools from tools.py

<Steps>
  <Step title="Create tools.py">
    ```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    # tools.py
    def analyze_data(data: str) -> dict:
        """Analyze input data.
        
        Args:
            data: Data to analyze
            
        Returns:
            Analysis results
        """
        return {"analysis": "complete", "data": data}
    ```
  </Step>

  <Step title="Assign to Agent">
    ```yaml theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    # agents.yaml
    roles:
      analyst:
        role: Data Analyst
        tools:
          - analyze_data
        tasks:
          analyze:
            description: "Analyze the provided data"
    ```
  </Step>

  <Step title="Run Template">
    ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    praisonai templates run ./my-template
    ```
  </Step>
</Steps>

## How to Assign Tools from External Sources

<Steps>
  <Step title="Add tools_sources">
    ```yaml theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    # TEMPLATE.yaml
    requires:
      tools_sources:
        - praisonai_tools.video
        - ./extra_tools.py
    ```
  </Step>

  <Step title="Assign External Tools">
    ```yaml theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    # agents.yaml
    roles:
      video_editor:
        role: Video Editor
        tools:
          - shell_tool
        tasks:
          edit:
            description: |
              Use python -m praisonai_tools.video to edit videos
    ```
  </Step>
</Steps>

## How to Assign Tools Dynamically with Python

<Steps>
  <Step title="Load Template">
    ```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    from praisonai.templates.loader import TemplateLoader

    loader = TemplateLoader()
    template = loader.load_template("my-template")
    ```
  </Step>

  <Step title="Create Custom Tools">
    ```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    def custom_tool(input: str) -> str:
        """Custom processing tool."""
        return f"Processed: {input}"
    ```
  </Step>

  <Step title="Run with Additional Tools">
    ```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    result = template.run(
        task="Process data",
        additional_tools=[custom_tool]
    )
    ```
  </Step>
</Steps>

## Tool Assignment Best Practices

| Practice       | Description                        |
| -------------- | ---------------------------------- |
| Minimal tools  | Only assign tools each agent needs |
| Clear naming   | Use descriptive tool names         |
| Document tools | Include docstrings with Args       |
| Test tools     | Verify tools work before assigning |
| Group related  | Keep related tools together        |
