How to Handle Optional Tool Dependency in a Sequential Processing Pipeline?

Hi everyone,

I’m working on a sequential processing pipeline where I need to validate certain inputs based on specific criteria. The challenge I’m facing is that I have to use a tool to fetch some required information for validation. However, the tool is not always available—it might be present in some cases and absent in others.

My goal is to create a single pipeline that works seamlessly both when the tool is available and when it is not.

So far, I’ve tried using a single-agent approach with multiple tasks, and it works well when the tool is available. However, when the tool is missing, the system assumes the tool’s information and proceeds with validation based on that assumption, which is not ideal. The same issue occurs when using a multi-agent approach.

In the multi-task case, the first task processes the tool’s output, and the second task performs the criteria-based evaluation. I’ve noticed that in this setup, the evaluation output is incorrect. However, this issue does not occur in the multi-agent setup. Specifically, when I set the prompt for the second agent as its backstory, it works correctly, but when I provide the same information as a task description, it fails.

Is there a reason why this is happening? And is there a way to handle this scenario properly to ensure accurate validation regardless of whether the tool is present or not?

Any insights or suggestions would be greatly appreciated!

Thanks!