Creating a Conversable Agent in CrewAI with Human-in-the-Loop Interaction

HI @rokbenko ,
I am trying to build an agent which gets the data from an API by referring to a document in S3. The tool etc. is defined yet I want it to ask me any required parameters or api keys for completing the request. Even when I am trying with human_input = True I am not being asked any inputs. It is assuming example on it’s own and giving No data found finally.

    api_info_agent = Agent(
    role="API information fetcher",
    goal="Get the API information from the given.",
    backstory="""You are an expert in APIs.
    You understand the API documentation and can extract the information from it such as the important and mandatory parameters for the API, 
    type of authentication, headers etc.""",
    llm=llm,
    tools=[s3_extractor_tool],
    allow_delegation=True,
    memory=True,
    #human_input=True,
    verbose=False,
)
api_info_task = Task(
    description="""Get the precise and to the point API information from the given url 
    Give very precise and to the point information in well structured format ONLY ABOUT
    HOW TO GET THE DATA FROM THE API. Only include the relevant information for GET request.
    Do not throw any error. If any information required, ask the user for the information.""",
    expected_output="The API information required to GET the data from the API",
    human_input=True,
    agent=api_info_agent,
)

In General, the docs say, for API related stuff, for human in loop, there is a callback url, where one passes the human output. But this can also be done with a simple REACT loop. (You might find this approach in other agentic system, built from scratch without frameworks, example: video-db/director backend/…/reasoning.py)

The idea is to either use CrewFlow (I guess you can make it work with a normal Crew) . Basically, you structure your prompt, so as to get some {"run_state": { "requires_human_input": true }} or could use a score or array of values (if you know what are required).
The Crew run exits, you get the output of the run_state, save the execution state (context, history etc to db), and assign it an id, Crew Flows has flow_id .
So, next time the user same endpoint with a PATCH , load the flow, pass in the User query, and run the flow/task again.

This is something we have done, and it works.