def test_qp_agent_custom() -> None:
    """
    Test query pipeline agent.
    Implement via `AgentCustomQueryComponent` subclass.

    """
    agent_input = AgentInputComponent(fn=mock_agent_input_fn)
    fn_component = MyCustomAgentComponent(separator="/")
    agent_output = AgentFnComponent(fn=mock_agent_output_fn)
    qp = QueryPipeline(chain=[agent_input, fn_component, agent_output])

    agent_worker = QueryPipelineAgentWorker(pipeline=qp)
    agent_runner = AgentRunner(agent_worker=agent_worker)

    # test create_task
    task = agent_runner.create_task("foo")
    assert task.input == "foo"

    step_output = agent_runner.run_step(task.task_id)
    assert str(step_output.output) == "foo/foo"
    assert step_output.is_last is False

    step_output = agent_runner.run_step(task.task_id)
    assert str(step_output.output) == "foo/foo/foo/foo"
    assert step_output.is_last is True

    Test query pipeline agent.
    Implement via `AgentCustomQueryComponent` subclass.

    
llama-index-core/tests/agent/custom/test_query_pipeline.py