# How to pass tool input if we are using custom tool,and expected agent output is tool output

**URL:** <https://community.crewai.com/t/how-to-pass-tool-input-if-we-are-using-custom-tool-and-expected-agent-output-is-tool-output/5866>\
**Category:** General\
**Created:** [May 20, 2025, 7:48am UTC](https://community.crewai.com/t/how-to-pass-tool-input-if-we-are-using-custom-tool-and-expected-agent-output-is-tool-output/5866 "2025-05-20T07:48:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harikrishnan\_K](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/harikrishnan_k/32/3848_2.png) [@Harikrishnan\_K](https://community.crewai.com/u/Harikrishnan_K)\
**Post date:** [May 20, 2025, 7:48am UTC](https://community.crewai.com/t/how-to-pass-tool-input-if-we-are-using-custom-tool-and-expected-agent-output-is-tool-output/5866/1 "2025-05-20T07:48:31Z")

</div>

I’m trying to build a tool-based workflow using `crewai` where an agent fetches stock data via a custom tool I defined the tool correctly with `args_schema`, passed it to the agent, and provided inputs via `tools_input`.

The tool is recognized.  
No errors are thrown.  
But the tool is **not actually executed** during the `crew.kickoff()` run — it seems the agent isn’t invoking the tool at all.

Here’s how I defined the task:

```python
Task(
    description="Fetch stock data and save as CSV.",
    expected_output="CSV files with stock history data.",
    agent=agentDataPipeline(),
    tools=[MyCustomTool(result_as_answer=True)],
    tools_input={
        "Stock Data Downloader Tool": {
            "company_names": ["AAPL", "MSFT", "TSLA"],
            "days": 15,
            "save_data": True
        }
    }
)

```

What I need:

- A minimal working example where a custom tool _is actually called_ during execution by passing tool input para/args
- Any advice on prompt structure or configuration that forces the agent to use the tool.

---

<div class="post-metadata">

**Author:** ![Tony\_Wood](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/tony_wood/32/1876_2.png) [@Tony\_Wood](https://community.crewai.com/u/Tony_Wood)\
**Post date:** [May 20, 2025, 7:53am UTC](https://community.crewai.com/t/how-to-pass-tool-input-if-we-are-using-custom-tool-and-expected-agent-output-is-tool-output/5866/2 "2025-05-20T07:53:00Z")

</div>

Yes it is interesting the first time as all you need to do is point your Task at the tool. in the config and also in the copy of the task yaml.  
I build a really simple tool for QDRant amongst others. Here is the example [GitHub - yqup/crewai-qdrant: CrewAI tool to update qdrant](https://github.com/yqup/crewai-qdrant)

Think “How would I explain the tool to a smart intern” and this will then get you started.

You point the intern to the tool and [Tools - CrewAI](https://docs.crewai.com/concepts/tools) in the crew setup and then tell it in the yaml.. I hope this helps.

---

<div class="post-metadata">

**Author:** ![Harikrishnan\_K](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/harikrishnan_k/32/3848_2.png) [@Harikrishnan\_K](https://community.crewai.com/u/Harikrishnan_K)\
**Post date:** [May 20, 2025, 9:40am UTC](https://community.crewai.com/t/how-to-pass-tool-input-if-we-are-using-custom-tool-and-expected-agent-output-is-tool-output/5866/3 "2025-05-20T09:40:01Z")

</div>

Thank you @Tony_Wood for your response ,That example didn’t worked for me.But when i passed input details in backstory somehow it worked.I have tried the same method with other custom tools also,those also worked without any issues.Is it the right method,as i couldnt see any examples from documentation page.

```auto

inputs ={
    "company_names":["AAPL", "MSFT", "TSLA","AMZN","META"],
    "days":15,
    "save_data":True
}

# custom_tool = MyCustomTool(
# company_names=["AAPL", "MSFT", "TSLA"],
# days=15,
# save_data=True
# )
# custom_tool = MyCustomTool()
def agentDataPipeline():
    return Agent(
        role="Data Extractor ",
        goal="Fetch stock data and save as CSV",
        backstory=f"""You are responsible for fetching data based on {inputs}.""",
        verbose=True,
        llm=llm,
        allow_delegation=False,
        # tools = [custom_tool],
        tools = [MyCustomTool()],
    )
def data_task():
    return Task(
        description="Fetch stock data and save as CSV.",
        expected_output="CSV files with stock history data.",
        agent=agentDataPipeline(),
        # tools = [custom_tool],
       
        
    )

```

---

<div class="post-metadata">

**Author:** ![Tony\_Wood](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/tony_wood/32/1876_2.png) [@Tony\_Wood](https://community.crewai.com/u/Tony_Wood)\
**Post date:** [May 20, 2025, 9:49am UTC](https://community.crewai.com/t/how-to-pass-tool-input-if-we-are-using-custom-tool-and-expected-agent-output-is-tool-output/5866/4 "2025-05-20T09:49:48Z")

</div>

oh I see something that might help.

Tools are defined in the Task and not in the Agent.  
Also try adding to the task description` "Fetch stock data and save as CSV using the MyCustomTool"`

Here is an example

```
   @agent
    def read_releases(self) -> Agent:
        return Agent(
            config=self.agents_config['read_releases'],
            verbose=False
        )

    @task
    def read_releases_task(self) -> Task:
        return Task(
            config=self.tasks_config['read_releases_task'],
            #output_file='releases.md',
            tools=[SerperDevTool(), ScrapeWebsiteTool()]
        )

```
